From 6bfc6a2b1065bc4e82552f451e670948478a6445 Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Tue, 2 Dec 2014 22:13:31 +1100 Subject: [PATCH] Fix deadlock in tests --- src/map/map.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/map/map.cpp b/src/map/map.cpp index 116abc590..d7e810892 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -278,15 +278,21 @@ void Map::run() { #endif assert(uv_thread_self() == map_thread); - check_for_pause(); + if (async) { + check_for_pause(); + } setup(); prepare(); - terminating = false; - while(!terminating) { + if (async) { + terminating = false; + while(!terminating) { + uv_run(**loop, UV_RUN_DEFAULT); + check_for_pause(); + } + } else { uv_run(**loop, UV_RUN_DEFAULT); - check_for_pause(); } // Run the event loop once more to make sure our async delete handlers are called.