From 06e09f7ea8cb8839eee54e7ca89d79c8d28f8867 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 19:53:54 +0100 Subject: [PATCH] worker: spin uv_run twice before closing loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, the Platform’s `uv_async_t` may need two iterations before closing when it was previously in use. Refs: https://github.com/nodejs/node/pull/26089 Refs: https://github.com/nodejs/node/pull/26006 --- src/node_worker.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index f38b187c18c5b8..783a624c0c811a 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -150,7 +150,10 @@ class WorkerThreadData { isolate->Dispose(); - // Need to run the loop one more time to close the platform's uv_async_t + // Need to run the loop twice more to close the platform's uv_async_t + // TODO(addaleax): It would be better for the platform itself to provide + // some kind of notification when it has fully cleaned up. + uv_run(&loop_, UV_RUN_ONCE); uv_run(&loop_, UV_RUN_ONCE); CheckedUvLoopClose(&loop_);