Commit d7419412 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

don't hold the thread mutex while the calling thread is working.

parent cb374bbc
......@@ -309,7 +309,9 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
}
/* Do some work while I'm at it. */
pthread_mutex_unlock(&tp->thread_mutex);
threadpool_chomp(tp, tp->num_threads - 1);
pthread_mutex_lock(&tp->thread_mutex);
/* Wait for all threads to be done. */
while (tp->num_threads_waiting < tp->num_threads - 1) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment