25 #ifndef TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_OPREC_H_
26 #define TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_OPREC_H_
40 namespace containers {
51 Helper *h = helper_.load();
52 if (h !=
nullptr && h != fail_val_) {
57 virtual void * associate(
Helper *h) = 0;
61 bool res = helper_.compare_exchange_strong(temp, h);
62 if (res || temp ==
nullptr) {
70 return helper_.load() == h;
75 helper_.compare_exchange_strong(temp, fail_val_);
79 return (h=helper_.load()) == fail_val_;
84 return helper_.load();
88 return helper_.load() ==
nullptr;
95 static constexpr
Helper * fail_val_ =
reinterpret_cast<Helper *
>(0x1L);
98 std::atomic<Helper *> helper_{
nullptr};
105 #endif // TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_OPREC_H_
Helper * getHelper()
Definition: ring_buffer_op.h:83
bool privAssociate(Helper *h)
Definition: ring_buffer_op.h:59
void fail()
Definition: ring_buffer_op.h:73
TODO(steven):
Definition: mcas.h:36
bool valid(Helper *h)
Definition: ring_buffer_op.h:69
#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
BufferOp(RingBuffer< T > *rb)
Definition: ring_buffer_op.h:46
This class is used to create Operation Records.
Definition: progress_assurance.h:52
~BufferOp()
Definition: ring_buffer_op.h:50
RingBuffer< T > * rb_
Definition: ring_buffer_op.h:97
bool isFail(Helper *&h)
Definition: ring_buffer_op.h:78
bool notDone()
Definition: ring_buffer_op.h:87