26 #ifndef TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_DEQUEUEOP_IMP_H_
27 #define TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_DEQUEUEOP_IMP_H_
32 namespace containers {
39 int64_t head = this->
rb_->getHead();
41 if (this->
rb_->isEmpty(this->rb_->getTail(), head)) {
47 int64_t seqid = head++;
48 uint64_t pos = this->
rb_->getPos(seqid);
53 if (!this->
rb_->readValue(pos, val)) {
59 bool val_isDelayedMarked;
60 this->
rb_->getInfo(val, val_seqid, val_isValueType, val_isDelayedMarked);
63 if (val_seqid > head) {
66 }
else if (val_isValueType) {
74 bool res = this->
rb_->array_[pos].compare_exchange_strong(val, helper_int);
80 std::atomic<void *> *temp1;
81 temp1 =
reinterpret_cast<std::atomic<void *> *
>(&(this->
rb_->array_[pos]));
82 void *temp2 =
reinterpret_cast<void *
>(helper_int);
85 if (!helper->
valid()) {
105 if (val_isDelayedMarked) {
109 this->
rb_->atomic_delay_mark(pos);
127 int64_t next_seqid = this->rb_->nextSeqId(seqid);
134 Helper *htemp = this->helper_.load();
145 int64_t head_temp = this->rb_->getHead();
146 while ( head_temp < (seqid + 1) ) {
147 if (this->rb_->casHead(head_temp, seqid + 1))
152 return reinterpret_cast<void *
>(new_val);
173 #endif // TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_DEQUEUEOP_IMP_H_
void help_complete()
Implementations of this function that upon its return the operation described in the OpRecord has bee...
Definition: dequeue_op_imp.h:38
void * associate(Helper *h)
Definition: dequeue_op_imp.h:120
static uintptr_t EmptyType(int64_t seqid)
Creates a uintptr_t that represents an EmptyType.
Definition: ring_buffer_imp.h:358
bool privAssociate(Helper *h)
Definition: ring_buffer_op.h:59
void fail()
Definition: ring_buffer_op.h:73
TODO(steven):
Definition: mcas.h:36
const uintptr_t old_value_
Definition: helper.h:62
static int64_t getEmptyTypeSeqId(uintptr_t val)
Returns the seqid encoded in the passed value.
Definition: ring_buffer_imp.h:380
static constexpr Helper * fail_val_
Definition: ring_buffer_op.h:95
static uintptr_t DelayMarkValue(uintptr_t val)
Takes a uintptr_t and places a bitmark on the delayMark_lsb.
Definition: ring_buffer_imp.h:374
This is a non-blocking FIFO ring buffer design that was made wait-free by applying a progress assuran...
Definition: ring_buffer.h:73
void safe_delete(bool no_check=false, ElementList *const element_list=tervel::tl_thread_info->get_hp_element_list())
This function is used to free a hazard pointer protected object if it is safe to do so OR add it to a...
Definition: hp_element.h:67
bool result(T &val)
Definition: dequeue_op_imp.h:158
static T getValueType(uintptr_t val)
Returns the value type from a uintptr.
Definition: ring_buffer_imp.h:109
static int64_t getValueTypeSeqId(uintptr_t val)
Returns the seqid of the passed value.
Definition: ring_buffer_imp.h:385
RingBuffer< T > * rb_
Definition: ring_buffer_op.h:97
bool on_watch(std::atomic< void * > *address, void *expected)
This function is used to achieve a strong watch on an Element.
Definition: helper_imp.h:40
static uintptr_t HelperType(Helper *h)
Returns a uintptr_t for the passed helper object.
Definition: helper_imp.h:88
bool valid()
Definition: helper_imp.h:81
bool isFail(Helper *&h)
Definition: ring_buffer_op.h:78
bool notDone()
Definition: ring_buffer_op.h:87