unsigned long nr_work; /* Current number of work items */
int worker_flags; /* Worker flags */
- bool shutdown; /* Shutdown performed */
+ int shutdown; /* Shutdown performed */
};
struct urcu_worker {
/*
* Make sure we are removed from waitqueue.
*/
- if (CMM_LOAD_SHARED(worker->wait_node.node.next))
+ if (urcu_in_waitqueue(&worker->wait_node))
__urcu_workqueue_wakeup_all(queue);
/*
return URCU_ACCEPT_SHUTDOWN;
urcu_wait_set_state(&worker->wait_node,
URCU_WAIT_WAITING);
- if (!CMM_LOAD_SHARED(worker->wait_node.node.next)) {
+ if (!urcu_in_waitqueue(&worker->wait_node)) {
int was_empty;
- /*
- * NULL next pointer. We are therefore not in
- * the queue.
- */
- cds_lfs_node_init(&worker->wait_node.node);
/* Protect stack dequeue against ABA */
synchronize_rcu();
was_empty = !urcu_wait_add(&queue->waitqueue,
}
} else {
/*
- * Non-NULL next pointer. We are therefore in
- * the queue, or the dispatcher just removed us
- * from it (after we read the next pointer), and
- * is therefore awakening us. The state will
- * therefore have been changed from WAITING to
- * some other state, which will let the busy
- * wait pass through.
+ * We are in the queue, or the dispatcher just removed
+ * us from it (after we read the next pointer), and is
+ * therefore awakening us. The state will therefore have
+ * been changed from WAITING to some other state, which
+ * will let the busy wait pass through.
*/
}
urcu_adaptative_busy_wait(&worker->wait_node);
struct urcu_worker *sibling;
bool has_work = false;
- rcu_read_lock();
- /* Steal from each worker */
- cds_list_for_each_entry_rcu(sibling, &queue->sibling_head,
- sibling_node)
- has_work |= ___urcu_grab_work(worker, &sibling->head,
- &sibling->tail, 1);
- rcu_read_unlock();
+ if (worker->flags & URCU_WORKER_STEAL) {
+ rcu_read_lock();
+ /* Steal from each worker */
+ cds_list_for_each_entry_rcu(sibling, &queue->sibling_head,
+ sibling_node)
+ has_work |= ___urcu_grab_work(worker, &sibling->head,
+ &sibling->tail, 1);
+ rcu_read_unlock();
+ }
/* Steal from global workqueue */
has_work |= ___urcu_grab_work(worker, &queue->head, &queue->tail, 0);