tlds
Transactional Operations for Linked Data Structures
|
#include <lehigh.h>
Public Member Functions | |
comparator (long int(*c1)(const void *, const void *), TM_CALLABLE long int(*c2)(TM_ARGDECL const void *, const void *)) | |
comparator (long int(*c1)(const pair_t *, const pair_t *), TM_CALLABLE long int(*c2)(TM_ARGDECL const pair_t *, const pair_t *)) | |
Public Attributes | |
union { | |
long int(* compare_notm )(const void *, const void *) | |
long int(* compare_pair_notm )(const pair_t *, const pair_t *) | |
}; | |
union { | |
TM_CALLABLE long int(* compare_tm )(TM_ARGDECL const void *, const void *) | |
TM_CALLABLE long int(* compare_pair_tm )(TM_ARGDECL const pair_t *, const pair_t *) | |
}; | |
Copyright (C) 2011 University of Rochester Department of Computer Science and Lehigh University Department of Computer Science and Engineering
License: Modified BSD Please see the file LICENSE.RSTM for licensing information STAMP does some odd things with function pointers, which makes g++ unhappy and makes it very hard to reason about the correctness of code. The most offensive is that STAMP may coerce a function pointer for a 3-argument comparison function into a 2-argument comparison function.
We avoid this situation by saying that rather than store a function pointer within a collection's root node, we'll store a pointer to a struct, where the struct has two function pointers: one for transactional code, one for nontransactional code, with 3 and 2 parameters, respectively. This adds a level of indirection (though only once per collection traversal, if we are careful), but increases safety and allows better reasoning.
|
inline |
|
inline |
union { ... } |
union { ... } |
long int(* comparator::compare_notm)(const void *, const void *) |
TM_CALLABLE long int(* comparator::compare_pair_tm)(TM_ARGDECL const pair_t *, const pair_t *) |
TM_CALLABLE long int(* comparator::compare_tm)(TM_ARGDECL const void *, const void *) |