From 2e4e2e1a79384a614bf1106860f4a6505e997adc Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 5 Apr 2019 09:22:42 +0200 Subject: [PATCH] /v1/events: don't deadlock other coroutines --- lib/remote/eventshandler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/remote/eventshandler.cpp b/lib/remote/eventshandler.cpp index 4bc028514..98e815354 100644 --- a/lib/remote/eventshandler.cpp +++ b/lib/remote/eventshandler.cpp @@ -101,6 +101,7 @@ bool EventsHandler::HandleRequest( } asio::const_buffer newLine ("\n", 1); + AsioConditionVariable dontLockOwnStrand (stream.get_io_service(), true); for (;;) { auto event (queue->WaitForEvent(&request, yc)); @@ -119,6 +120,8 @@ bool EventsHandler::HandleRequest( stream.async_flush(yc); } else if (server.Disconnected()) { return true; + } else { + dontLockOwnStrand.Wait(yc); } } }