Tervel  1.0.0
A collection of wait-free containers and algorithms.
helper.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_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_HELPER_H_
26 #define TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_HELPER_H_
27 
30 
31 namespace tervel {
32 namespace containers {
33 namespace wf {
34 
35 template<typename T>
37  public:
38  Helper(BufferOp *op, uintptr_t old_value)
39  : op_(op)
40  , old_value_(old_value) {}
41  ~Helper() {}
42 
43  bool on_watch(std::atomic<void *> *address, void *expected);
44  void * associate();
45  bool valid();
46 
55  static inline uintptr_t HelperType(Helper *h);
56 
57  static inline bool isHelperType(uintptr_t val);
58 
59  static inline Helper *getHelperType(uintptr_t val);
60 
62  const uintptr_t old_value_;
63 
64 };
65 
66 
67 } // namespace wf
68 } // namespace containers
69 } // namespace tervel
70 
71 #endif // TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_HELPER_H_
TODO(steven):
Definition: mcas.h:36
const uintptr_t old_value_
Definition: helper.h:62
BufferOp * op_
Definition: helper.h:61
This class is used for the creation of Hazard Pointer Protected Objects Objects which extend it have ...
Definition: hp_element.h:53
This is a non-blocking FIFO ring buffer design that was made wait-free by applying a progress assuran...
Definition: ring_buffer.h:73
Definition: ring_buffer_op.h:44
Helper(BufferOp *op, uintptr_t old_value)
Definition: helper.h:38