From 2be240d3cd938c95699de5cc71963b1fcc47de4d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 29 Nov 2012 15:34:33 +0100 Subject: [PATCH] unix: initialize thread pool mutex and condvar It accidentally worked before this commit on Linux but not on OS X. Fixes #637. --- src/unix/threadpool.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/unix/threadpool.c b/src/unix/threadpool.c index 3be272259..ab2f59c3e 100644 --- a/src/unix/threadpool.c +++ b/src/unix/threadpool.c @@ -76,6 +76,12 @@ static void post(ngx_queue_t* q) { static void init_once(void) { unsigned int i; + if (uv_cond_init(&cond)) + abort(); + + if (uv_mutex_init(&mutex)) + abort(); + ngx_queue_init(&wq); for (i = 0; i < ARRAY_SIZE(threads); i++) @@ -100,6 +106,8 @@ static void cleanup(void) { if (uv_thread_join(threads + i)) abort(); + uv_mutex_destroy(&mutex); + uv_cond_destroy(&cond); initialized = 0; } #endif