From 531b08555d342eaee7fe352d9df8651f51ceda4f Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 11 Mar 2015 14:30:10 +0100 Subject: [PATCH] test: fix race condition in multithreaded test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main thread's epilog closed the file descriptor without waiting for the worker to shut down, making it sporadically fail with a EBADF error. Fixes: https://github.com/libuv/libuv/issues/248 PR-URL: https://github.com/libuv/libuv/pull/256 Reviewed-By: Saúl Ibarra Corretgé --- test/test-pipe-set-non-blocking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-pipe-set-non-blocking.c b/test/test-pipe-set-non-blocking.c index 5cf2c19e..fcc9fc0d 100644 --- a/test/test-pipe-set-non-blocking.c +++ b/test/test-pipe-set-non-blocking.c @@ -88,8 +88,8 @@ TEST_IMPL(pipe_set_non_blocking) { uv_close((uv_handle_t*) &pipe_handle, NULL); ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); - ASSERT(0 == close(fd[1])); /* fd[0] is closed by uv_close(). */ ASSERT(0 == uv_thread_join(&thread)); + ASSERT(0 == close(fd[1])); /* fd[0] is closed by uv_close(). */ uv_barrier_destroy(&ctx.barrier); MAKE_VALGRIND_HAPPY();