X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=src%2Fworkqueue.c;h=14957a0d3910aa83740d4e22b5420aa48658cf84;hp=db0c63abf711307e995b3bd5cb372f560bd83711;hb=89d19b437b1467f98ecee4190d1160e99111671f;hpb=1b6fc1735dcbdcb5c65f30bd9f80522edd9c4b24 diff --git a/src/workqueue.c b/src/workqueue.c index db0c63a..14957a0 100644 --- a/src/workqueue.c +++ b/src/workqueue.c @@ -221,11 +221,11 @@ static void *workqueue_thread(void *arg) cbcount = 0; __cds_wfcq_for_each_blocking_safe(&cbs_tmp_head, &cbs_tmp_tail, cbs, cbs_tmp_n) { - struct rcu_head *rhp; + struct urcu_work *uwp; - rhp = caa_container_of(cbs, - struct rcu_head, next); - rhp->func(rhp); + uwp = caa_container_of(cbs, + struct urcu_work, next); + uwp->func(uwp); cbcount++; } uatomic_sub(&workqueue->qlen, cbcount); @@ -238,18 +238,18 @@ static void *workqueue_thread(void *arg) if (cds_wfcq_empty(&workqueue->cbs_head, &workqueue->cbs_tail)) { futex_wait(&workqueue->futex); - (void) poll(NULL, 0, 10); uatomic_dec(&workqueue->futex); /* * Decrement futex before reading * urcu_work list. */ cmm_smp_mb(); - } else { - (void) poll(NULL, 0, 10); } } else { - (void) poll(NULL, 0, 10); + if (cds_wfcq_empty(&workqueue->cbs_head, + &workqueue->cbs_tail)) { + (void) poll(NULL, 0, 10); + } } if (workqueue->worker_after_wake_up_fct) workqueue->worker_after_wake_up_fct(workqueue, workqueue->priv);