From cb8bfa9a32799bcde4e960fa56e388d5f7b2a928 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Tue, 15 Aug 2017 09:02:16 +0200 Subject: [PATCH] SVP always drain the wakeup pipe When we have a lot of idle tasks and generate new tasks, the wakeup pipe fills and is never drained, so OSL_ENSURE in Wakeup() starts to fail. This simply drains the pipe on every run, which processed an event. Change-Id: I7b6366b2649133b63138dc77fe51508404132890 --- vcl/headless/svpinst.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 4b76f0c3fbec..4ebeac8f4a3c 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -370,6 +370,12 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong DoReleaseYield(nTimeoutMS); } + else if ( bEvent ) + { + // Drain the wakeup pipe + int buffer; + while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0); + } return bEvent; } @@ -394,8 +400,7 @@ void SvpSalInstance::DoReleaseYield( int nTimeoutMS ) if( (aPoll.revents & POLLIN) != 0 ) { int buffer; - while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0) - continue; + while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0); } }