Commit fe83daa4 authored by Xiwen JIANG's avatar Xiwen JIANG

add lock to thread pool start

parent d559d9ec
...@@ -55,10 +55,12 @@ void thread_pool_start(thread_pool *pool) ...@@ -55,10 +55,12 @@ void thread_pool_start(thread_pool *pool)
abort(); abort();
} }
if (pthread_mutex_lock(pool->mutex)) abort();
pool->done = 0; pool->done = 0;
pool->running = pool->number_of_threads; pool->running = pool->number_of_threads;
if (pthread_cond_broadcast(pool->cond)) abort(); if (pthread_cond_broadcast(pool->cond)) abort();
if (pthread_mutex_unlock(pool->mutex)) abort();
} }
void thread_pool_done(thread_pool *pool) void thread_pool_done(thread_pool *pool)
......
Markdown is supported
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