Tervel  1.0.0
A collection of wait-free containers and algorithms.
tervel.h
Go to the documentation of this file.
1 /*
2 The MIT License (MIT)
3 
4 Copyright (c) 2015 University of Central Florida's Computer Software Engineering
5 Scalable & Secure Systems (CSE - S3) Lab
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 */
25 #ifndef TERVEL_UTIL_TERVEL_H
26 #define TERVEL_UTIL_TERVEL_H
27 
28 #include <tervel/util/util.h>
33 
34 namespace tervel {
35 
39 class Tervel {
40  public:
41  explicit Tervel(size_t num_threads)
42  : num_threads_ {num_threads}
43  , hazard_pointer_(num_threads)
44  , rc_pool_manager_(num_threads)
45  , progress_assurance_(num_threads) {}
46 
47  ~Tervel() {
48  // Notice: The destructor of the member variables are called when this
49  // object is freed.
50  }
51 
52  private:
53  uint64_t get_thread_id() {
54  return active_threads_.fetch_add(1);
55  }
56 
57  // The total number of expected threads in the system.
58  const uint64_t num_threads_;
59 
60  // The number of threads which have been assigned an thread_id
61  std::atomic<uint64_t> active_threads_ {0};
62 
63  // The shared hazard_pointer object
65 
66  // Shared RC Descriptor Pool Manager
68 
69  // Shared Progress Assurance Object
71 
72  friend ThreadContext;
73 
75 };
76 
77 } // namespace tervel
78 #endif // TERVEL_UTIL_TERVEL_H
A manager class for the reference count protected memory pools.
Definition: pool_manager.h:54
util::memory::hp::HazardPointer hazard_pointer_
Definition: tervel.h:64
friend ThreadContext
Definition: tervel.h:72
const uint64_t num_threads_
Definition: tervel.h:58
TODO(steven):
Definition: mcas.h:36
util::ProgressAssurance progress_assurance_
Definition: tervel.h:70
Tervel(size_t num_threads)
Definition: tervel.h:41
util::memory::rc::PoolManager rc_pool_manager_
Definition: tervel.h:67
This class represents the progress assurance scheme employed by our library.
Definition: progress_assurance.h:106
uint64_t get_thread_id()
Definition: tervel.h:53
Contains shared information that should be accessible by all threads.
Definition: tervel.h:39
std::atomic< uint64_t > active_threads_
Definition: tervel.h:61
DISALLOW_COPY_AND_ASSIGN(Tervel)
~Tervel()
Definition: tervel.h:47
This class is used to maintain the list of hazard pointed objects.
Definition: hazard_pointer.h:56