X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=test%2Frcu_test.c;h=b2dedaae418d974406b0697cbdef7457efb107c5;hp=d4696481a8b1369759c93fb6f5307b9cf00cfe37;hb=778b8c8ca708b082a1192acfb114a6751b2ad7c9;hpb=a1d0b3ca99552878b1becf561d8f3291992aaa67 diff --git a/test/rcu_test.c b/test/rcu_test.c index d469648..b2dedaa 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; @@ -78,9 +78,9 @@ void *worker (void *arg) { } int main (int argc, char **argv) { - //lwt_set_trace_level("m0r0"); + lwt_set_trace_level("m3r3"); - int num_threads = 2; + int num_threads = MAX_NUM_THREADS; if (argc == 2) { errno = 0;