X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=test%2Frcu_test.c;h=14134b9f1a499057216fd3111d18b63932e100f2;hb=7d658a03f83e64690d0c71b4733dd3f9a2c60208;hp=3fd10d5a60f4b785f784b914f16f9ec9b682c40e;hpb=2b107655a1df8ae7703b44ef8cf1430a7250a5c3;p=nbds diff --git a/test/rcu_test.c b/test/rcu_test.c index 3fd10d5..14134b9 100644 --- a/test/rcu_test.c +++ b/test/rcu_test.c @@ -30,18 +30,18 @@ static lifo_t *lifo_alloc (void) { static void lifo_aba_push (lifo_t *stk, node_t *x) { node_t *head; do { - head = ((volatile lifo_t *)stk)->head; - ((volatile node_t *)x)->next = head; - } while (__sync_val_compare_and_swap(&stk->head, head, x) != head); + head = VOLATILE_DEREF(stk).head; + VOLATILE_DEREF(x).next = head; + } while (SYNC_CAS(&stk->head, head, x) != head); } node_t *lifo_aba_pop (lifo_t *stk) { node_t *head; do { - head = ((volatile lifo_t *)stk)->head; + head = VOLATILE_DEREF(stk).head; if (head == NULL) return NULL; - } while (__sync_val_compare_and_swap(&stk->head, head, head->next) != head); + } while (SYNC_CAS(&stk->head, head, head->next) != head); head->next = NULL; return head; } @@ -57,7 +57,7 @@ void *worker (void *arg) { unsigned int rand_seed = (unsigned int)id + 1; // Wait for all the worker threads to be ready. - __sync_fetch_and_add(&wait_, -1); + (void)__sync_fetch_and_add(&wait_, -1); do {} while (wait_); int i;