Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
1 merge request!375Threadpool task plots
...@@ -309,7 +309,9 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function, ...@@ -309,7 +309,9 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
} }
/* Do some work while I'm at it. */ /* Do some work while I'm at it. */
pthread_mutex_unlock(&tp->thread_mutex);
threadpool_chomp(tp, tp->num_threads - 1); threadpool_chomp(tp, tp->num_threads - 1);
pthread_mutex_lock(&tp->thread_mutex);
/* Wait for all threads to be done. */ /* Wait for all threads to be done. */
while (tp->num_threads_waiting < tp->num_threads - 1) { while (tp->num_threads_waiting < tp->num_threads - 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment