tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
comparator Struct Reference

#include <lehigh.h>

Collaboration diagram for comparator:

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 *)
 
}; 
 

Detailed Description

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.

Constructor & Destructor Documentation

comparator::comparator ( long int(*)(const void *, const void *)  c1,
TM_CALLABLE long int(*)(TM_ARGDECL const void *, const void *)  c2 
)
inline
comparator::comparator ( long int(*)(const pair_t *, const pair_t *)  c1,
TM_CALLABLE long int(*)(TM_ARGDECL const pair_t *, const pair_t *)  c2 
)
inline

Member Data Documentation

union { ... }
union { ... }
long int(* comparator::compare_notm)(const void *, const void *)
long int(* comparator::compare_pair_notm)(const pair_t *, const pair_t *)
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 *)

The documentation for this struct was generated from the following file: