workqueue: fix uninitialized mutex
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Oct 2014 18:54:33 +0000 (14:54 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Oct 2014 18:54:33 +0000 (14:54 -0400)
Also, tmp_head don't need to hold space for a lock, since only the local
thread is touching it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/workqueue-fifo.h

index 883f41f3feec4c0869f27c794f44a420ba80fdb5..ea6312f8548b28d8c0cf6cef79fb0bec54c1cfd0 100644 (file)
@@ -86,6 +86,7 @@ void urcu_workqueue_init(struct urcu_workqueue *queue)
        __cds_wfcq_init(&queue->head, &queue->tail);
        urcu_wait_queue_init(&queue->waitqueue);
        CDS_INIT_LIST_HEAD(&queue->sibling_head);
        __cds_wfcq_init(&queue->head, &queue->tail);
        urcu_wait_queue_init(&queue->waitqueue);
        CDS_INIT_LIST_HEAD(&queue->sibling_head);
+       pthread_mutex_init(&queue->sibling_lock, NULL);
        queue->shutdown = false;
 }
 
        queue->shutdown = false;
 }
 
@@ -204,7 +205,7 @@ bool ___urcu_grab_work(struct urcu_worker *worker,
                bool steal)
 {
        enum cds_wfcq_ret splice_ret;
                bool steal)
 {
        enum cds_wfcq_ret splice_ret;
-       struct cds_wfcq_head tmp_head;
+       struct __cds_wfcq_head tmp_head;
        struct cds_wfcq_tail tmp_tail;
        struct cds_wfcq_node *node;
 
        struct cds_wfcq_tail tmp_tail;
        struct cds_wfcq_node *node;
 
@@ -213,7 +214,7 @@ bool ___urcu_grab_work(struct urcu_worker *worker,
         */
        if (cds_wfcq_empty(src_head, src_tail))
                return false;
         */
        if (cds_wfcq_empty(src_head, src_tail))
                return false;
-       cds_wfcq_init(&tmp_head, &tmp_tail);
+       __cds_wfcq_init(&tmp_head, &tmp_tail);
 
        /* Ensure that we preserve FIFO work order. */
        assert(!steal || worker->own == NULL);
 
        /* Ensure that we preserve FIFO work order. */
        assert(!steal || worker->own == NULL);
@@ -254,7 +255,7 @@ got_node:
        }
 
        /* Splice into worker workqueue. */
        }
 
        /* Splice into worker workqueue. */
-       splice_ret = cds_wfcq_splice_blocking(&worker->head,
+       splice_ret = __cds_wfcq_splice_blocking(&worker->head,
                        &worker->tail,
                        &tmp_head,
                        &tmp_tail);
                        &worker->tail,
                        &tmp_head,
                        &tmp_tail);
This page took 0.025368 seconds and 4 git commands to generate.