Tervel  1.0.0
A collection of wait-free containers and algorithms.
enqueue_op.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_ENQUEUEOP_H_
26 #define TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_ENQUEUEOP_H_
27 
29 
30 namespace tervel {
31 namespace containers {
32 namespace wf {
33 
34 
35 template<typename T>
36 class RingBuffer<T>::EnqueueOp: public BufferOp {
37  public:
38  EnqueueOp(RingBuffer<T> *rb, T value)
39  : BufferOp(rb)
40  , value_(value) {
41  int64_t seqid = reinterpret_cast<int64_t>(this) * -1;
42  value_->func_seqid(seqid);
43  }
44 
45  void * associate(Helper *h);
46  void help_complete();
47  bool result();
48 
49  private:
50  const T value_;
52 };
53 
54 } // namespace wf
55 } // namespace containers
56 } // namespace tervel
57 
58 #endif // TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_ENQUEUEOP_H_
const T value_
Definition: enqueue_op.h:50
TODO(steven):
Definition: mcas.h:36
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: util.h:205
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
EnqueueOp(RingBuffer< T > *rb, T value)
Definition: enqueue_op.h:38