Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unix: initialize thread pool mutex and condvar

It accidentally worked before this commit on Linux but not on OS X.

Fixes #637.
  • Loading branch information...
commit 2be240d3cd938c95699de5cc71963b1fcc47de4d 1 parent 3a30258
@bnoordhuis bnoordhuis authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/unix/threadpool.c
View
8 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
Please sign in to comment.
Something went wrong with that request. Please try again.