25 #ifndef TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_ENQUEUEOP_IMP_H_
26 #define TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_ENQUEUEOP_IMP_H_
31 namespace containers {
38 int64_t tail = this->
rb_->getTail();
40 if (this->
rb_->isFull(tail, this->rb_->getHead())) {
44 int64_t seqid = tail++;
45 uint64_t pos = this->
rb_->getPos(seqid);
49 if (!this->
rb_->readValue(pos, val)) {
55 bool val_isDelayedMarked;
56 this->
rb_->getInfo(val, val_seqid, val_isValueType, val_isDelayedMarked);
59 if (val_seqid > tail) {
62 }
else if (val_isDelayedMarked) {
66 }
else if (val_isValueType) {
76 bool res = this->
rb_->array_[pos].compare_exchange_strong(val, helper_int);
82 std::atomic<void *> *temp1;
83 temp1 =
reinterpret_cast<std::atomic<void *> *
>(&(this->
rb_->array_[pos]));
84 void *temp2 =
reinterpret_cast<void *
>(helper_int);
86 if (!helper->
valid()) {
108 int64_t ev_seqid =
reinterpret_cast<int64_t
>(
this) * -1;
109 int64_t seqid = this->rb_->getEmptyTypeSeqId(h->
old_value_);
110 value_->atomic_change_seqid(ev_seqid, seqid);
112 uintptr_t temp =
reinterpret_cast<uintptr_t
>(value_);
113 assert((temp &
clear_lsb) == 0 &&
" reserved bits are not 0?");
119 int64_t seqid = value_->func_seqid() + 1;
120 int64_t temp = this->rb_->getTail();
121 while (temp < seqid) {
122 if (this->rb_->casTail(temp, seqid))
126 return reinterpret_cast<void *
>(new_val);
147 #endif // TERVEL_CONTAINERS_WF_RINGBUFFER_RINGBUFFER_ENQUEUEOP_IMP_H_
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
void * associate(Helper *h)
Definition: enqueue_op_imp.h:104
bool result()
Definition: enqueue_op_imp.h:134
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
void help_complete()
Implementations of this function that upon its return the operation described in the OpRecord has bee...
Definition: enqueue_op_imp.h:37
static const uintptr_t clear_lsb
Definition: ring_buffer.h:78
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