Skip to content

Commit 442491d

Browse files
committed
Remove unnecessary mutex lock in workerpool_add_task
We always create all the jobs before running
1 parent 4f19a56 commit 442491d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

common/workerpool.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,7 @@ void workerpool_add_task(workerpool_t *wp, void (*f)(void *p), void *p)
167167
t.f = f;
168168
t.p = p;
169169

170-
if (wp->nthreads > 1) {
171-
pthread_mutex_lock(&wp->mutex);
172-
zarray_add(wp->tasks, &t);
173-
pthread_mutex_unlock(&wp->mutex);
174-
} else {
175-
zarray_add(wp->tasks, &t);
176-
}
170+
zarray_add(wp->tasks, &t);
177171
}
178172

179173
void workerpool_run_single(workerpool_t *wp)

0 commit comments

Comments
 (0)