tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
edge_set.hpp
Go to the documentation of this file.
1 /**
2  * Copyright (C) 2011
3  * University of Rochester Department of Computer Science
4  * and
5  * Lehigh University Department of Computer Science and Engineering
6  *
7  * License: Modified BSD
8  * Please see the file LICENSE.RSTM for licensing information
9  */
10 
11 /* edge_set.hpp
12  *
13  * Concurrent set of edges.
14  * Good memory locality if your work is confined to a worker stripe.
15  *
16  * Thread-safe insert, erase, and contains methods.
17  * Insert and erase log to cout if output_incremental.
18  *
19  * Non-thread-safe print_all method.
20  */
21 
22 #ifndef EDGE_SET_HPP__
23 #define EDGE_SET_HPP__
24 
25 #include "tm_hash_set.hpp"
26  // I'd use tr1::unordered_set<edge*>, but icc isn't willing to accept
27  // its insert and erase routines as [[transaction_safe]].
28 
29 #include "edge.hpp"
30 
31 class edge_set {
34 public:
35  TRANSACTION_SAFE void insert(edge* e);
36  TRANSACTION_SAFE void erase(edge* e);
37  bool contains(edge* e) const;
38 
39  // for final output, if desired (unsynchronized)
40  void print_all() const;
41 
42  edge_set();
43  // constructor creates segments but does not initialize them
44  void help_initialize(int col);
45  // initialize segments in parallel with other threads
46 
47  ~edge_set();
48 };
49 
50 extern edge_set *edges;
51 
52 #endif // EDGE_SET_HPP__
edge_set()
Definition: edge_set.cpp:69
void print_all() const
Definition: edge_set.cpp:63
edge_set * edges
Definition: mesh.cpp:36
Definition: tm_hash_set.hpp:26
segment_t ** segments
Definition: edge_set.hpp:33
#define TRANSACTION_SAFE
Definition: common.hpp:87
Definition: edge.hpp:36
TRANSACTION_SAFE void erase(edge *e)
Definition: edge_set.cpp:48
Definition: edge_set.hpp:31
bool contains(edge *e) const
Definition: edge_set.cpp:56
TRANSACTION_SAFE void insert(edge *e)
Definition: edge_set.cpp:40
void help_initialize(int col)
Definition: edge_set.cpp:74
~edge_set()
Definition: edge_set.cpp:84
tm_hash_set< edge * > segment_t
Definition: edge_set.hpp:32