diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-06-18 14:42:20 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-06-22 12:28:48 +0200 |
commit | b9ea3467383ccdfe4be842e61267256f281487ee (patch) | |
tree | c712253c63944afd9f7bd327a7be2c4f47d0f8b0 /vcl/headless | |
parent | 054d6598b29171c3719d7144efe77a408fc4e716 (diff) |
svp: always release SolarMutex on yield
Always give other threads a chance to acquire the SolarMutex, if
we yield.
Change-Id: I77d93374ea606acd1f7820755197a27655418639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117454
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/svpinst.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 700c6b87f645..36859e9b3fb2 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -490,7 +490,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) else nTimeoutMicroS = -1; // wait until something happens - sal_uInt32 nAcquireCount = ReleaseYieldMutexAll(); + SolarMutexReleaser aReleaser; if (pSVData->mpPollCallback) { @@ -523,11 +523,12 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) } // here no need to check m_Request because Acquire will do it } - AcquireYieldMutex( nAcquireCount ); } - else if (bSkipPoll) + else { - pMutex->m_NonMainWaitingYieldCond.set(); // wake up other threads + if (bSkipPoll) + pMutex->m_NonMainWaitingYieldCond.set(); // wake up other threads + SolarMutexReleaser aReleaser; } } else // !IsMainThread() @@ -544,9 +545,8 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) { // block & release YieldMutex until the main thread does something pMutex->m_NonMainWaitingYieldCond.reset(); - sal_uInt32 nAcquireCount = ReleaseYieldMutexAll(); + SolarMutexReleaser aReleaser; pMutex->m_NonMainWaitingYieldCond.wait(); - AcquireYieldMutex( nAcquireCount ); } } |