diff --git a/deps/uv/src/unix/threadpool.c b/deps/uv/src/unix/threadpool.c index 0a02766e65..a1aaa2bd6e 100644 --- a/deps/uv/src/unix/threadpool.c +++ b/deps/uv/src/unix/threadpool.c @@ -31,6 +31,7 @@ static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_t threads[4]; static ngx_queue_t exit_message; static ngx_queue_t wq = { &wq, &wq }; +static volatile int initialized; static void* worker(void* arg) { @@ -89,6 +90,8 @@ static void init_once(void) { for (i = 0; i < ARRAY_SIZE(threads); i++) if (pthread_create(threads + i, NULL, worker, NULL)) abort(); + + initialized = 1; } @@ -97,11 +100,14 @@ static void cleanup(void) { unsigned int i; int err; + if (initialized == 0) + return; + post(&exit_message); for (i = 0; i < ARRAY_SIZE(threads); i++) { err = pthread_join(threads[i], NULL); - assert(err == 0 || err == EINVAL || err == ESRCH); + assert(err == 0 || err == ESRCH); (void) err; /* Silence compiler warning in release builds. */ } } diff --git a/deps/uv/test/runner-win.c b/deps/uv/test/runner-win.c index cf75c703d5..111a6869d1 100644 --- a/deps/uv/test/runner-win.c +++ b/deps/uv/test/runner-win.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "task.h" #include "runner.h" @@ -43,6 +44,8 @@ void platform_init(int argc, char **argv) { /* Disable the "application crashed" popup. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); _setmode(0, _O_BINARY); _setmode(1, _O_BINARY); diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 893be1a5f3..20c12e3e0a 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -27,6 +27,7 @@ TEST_DECLARE (condvar_2) TEST_DECLARE (condvar_3) TEST_DECLARE (condvar_4) TEST_DECLARE (condvar_5) +TEST_DECLARE (consumer_producer) TEST_DECLARE (semaphore_1) TEST_DECLARE (semaphore_2) TEST_DECLARE (semaphore_3) @@ -218,6 +219,7 @@ TASK_LIST_START TEST_ENTRY (condvar_3) TEST_ENTRY (condvar_4) TEST_ENTRY (condvar_5) + TEST_ENTRY (consumer_producer) TEST_ENTRY (semaphore_1) TEST_ENTRY (semaphore_2) TEST_ENTRY (semaphore_3) diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 622b234646..fadbd29e3a 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -306,6 +306,7 @@ 'test/test-signal.c', 'test/test-thread.c', 'test/test-condvar.c', + 'test/test-condvar-consumer-producer.c', 'test/test-timer-again.c', 'test/test-timer.c', 'test/test-tty.c',