20 bool complete(WFVector *vec,
int pos);
26 bool watch(
void *p, ArrayElement *a){
28 rc_count.fetch_add(1);
31 rc_count.fetch_add(-1);
37 controlOp->rc_count.fetch_add(1);
39 rc_count.fetch_add(-1);
40 controlOp->rc_count.fetch_add(-1);
49 rc_count.fetch_add(-1);
52 controlOp->rc_count.fetch_add(-1);
56 return (rc_count.load() !=0);
84 bool complete(WFVector *vec,
int pos);
87 bool watch(
void *p, ArrayElement *a){
89 rc_count.fetch_add(1);
92 rc_count.fetch_add(-1);
96 parent->rc_count.fetch_add(1);
98 rc_count.fetch_add(-1);
99 parent->rc_count.fetch_add(-1);
104 parent->
controlOp->rc_count.fetch_add(1);
106 parent->
controlOp->rc_count.fetch_add(-1);
107 rc_count.fetch_add(-1);
108 parent->rc_count.fetch_add(-1);
117 rc_count.fetch_add(-1);
118 parent->rc_count.fetch_add(-1);
120 parent->
controlOp->rc_count.fetch_add(-1);
124 return (rc_count.load() !=0);
136 if (expected== NULL){
137 if (
parent->
child.compare_exchange_strong(expected, (
void *)
this)){
143 if (expected ==
this){
162 assert(type == dt_popBackH );
167 if( (
parent->
child.compare_exchange_strong(e, (
void *)
this) || e==
this) ){
183 ArrayElement *spot=vec->getSpot(pos);
185 void *temp=Helper::mark(
this);
186 spot->compare_exchange_strong(temp, newValue);
192 if (
child.load()!= (
void *)0x1 ) {
216 assert(type == dt_popBack );
220 ArrayElement *pb=vec->getSpot(pos-1);
222 while (
child.load() == NULL) {
224 void *expected=pb->load();
226 if (Helper::isHelper(expected)) {
228 Helper *tHelper=Helper::unmark(expected);
229 if(!tHelper->watch(expected, pb)){
233 bool helpRes=Helper::remove(vec, pos-1, expected);
237 if(!helpRes && rDepth>0){
247 if (expected==NOT_VALUE){
249 if (
child.compare_exchange_strong(c_child,(
void *)0x1)){
255 if (pb->compare_exchange_strong(expected, Helper::mark(psh))){
266 ArrayElement *pa=vec->getSpot(pos);
268 void *temp=Helper::mark(
this);
269 pa->compare_exchange_strong(temp, NOT_VALUE);
271 if(
child.load() != psh)
279 if(this->isWatched()){
284 if (ph!=NULL && ph!=(
PopHelper *)(0x1) ){
void unwatch()
Definition: pop_helper.h:116
void * getValue()
Definition: pop_helper.h:133
void init(PopHelper *p)
Definition: pop_helper.h:71
bool getResult(void *&v)
Definition: pop_helper.h:191
std::atomic< void * > child
Definition: pop_helper.h:5
bool complete(WFVector *vec, int pos)
Definition: pop_helper.h:214
bool tryFree()
Definition: pop_helper.h:303
PopSubHelper(PopHelper *p)
Definition: pop_helper.h:79
Definition: pop_helper.h:66
PopHelper()
Definition: pop_helper.h:13
PopHelper * parent
Definition: pop_helper.h:69
void init(PopOp *cop)
Definition: pop_helper.h:7
void * value
Definition: pop_helper.h:68
PopHelper(PopOp *cop)
Definition: pop_helper.h:16
void * readThrough()
Definition: pop_helper.h:59
std::atomic< PopHelper * > assoc
Definition: pop_op.h:4
Definition: pop_helper.h:3
bool tryFree()
Definition: pop_helper.h:278
void unwatch()
Definition: pop_helper.h:48
void * readThrough()
Definition: pop_helper.h:127
bool isWatched()
Definition: pop_helper.h:123
bool watch(void *p, ArrayElement *a)
Definition: pop_helper.h:26
bool isWatched()
Definition: pop_helper.h:55
bool watch(void *p, ArrayElement *a)
Definition: pop_helper.h:87
bool tryFree()
Definition: pop_helper.h:324
PopOp * controlOp
Definition: pop_helper.h:6
bool complete(WFVector *vec, int pos)
Definition: pop_helper.h:161