X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=workqueue.c;h=2e01b584544b7434ae68081bf4282f8afa2e8a5c;hp=4f9c414ac1195927789d6f18f423f5ec00bacf1e;hb=aa2b823c;hpb=b5b603f474a069eb63839af05db1571a9c122b56 diff --git a/workqueue.c b/workqueue.c index 4f9c414a..2e01b584 100644 --- a/workqueue.c +++ b/workqueue.c @@ -278,8 +278,11 @@ static int start_worker(struct workqueue *wq, unsigned int index, int ret; INIT_FLIST_HEAD(&sw->work_list); - pthread_cond_init(&sw->cond, NULL); - pthread_mutex_init(&sw->lock, NULL); + + ret = mutex_cond_init_pshared(&sw->lock, &sw->cond); + if (ret) + return ret; + sw->wq = wq; sw->index = index; sw->sk_out = sk_out; @@ -308,15 +311,20 @@ int workqueue_init(struct thread_data *td, struct workqueue *wq, { unsigned int running; int i, error; + int ret; wq->max_workers = max_workers; wq->td = td; wq->ops = *ops; wq->work_seq = 0; wq->next_free_worker = 0; - pthread_cond_init(&wq->flush_cond, NULL); - pthread_mutex_init(&wq->flush_lock, NULL); - pthread_mutex_init(&wq->stat_lock, NULL); + + ret = mutex_cond_init_pshared(&wq->flush_lock, &wq->flush_cond); + if (ret) + goto err; + ret = mutex_init_pshared(&wq->stat_lock); + if (ret) + goto err; wq->workers = smalloc(wq->max_workers * sizeof(struct submit_worker));