diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpinst.cxx | 8 | ||||
-rw-r--r-- | vcl/inc/osx/runinmain.hxx | 6 | ||||
-rw-r--r-- | vcl/osx/salinst.cxx | 4 | ||||
-rw-r--r-- | vcl/qt5/Qt5Instance.cxx | 6 |
4 files changed, 14 insertions, 10 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 02e332b92fbf..335f70e4bba7 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <mutex> + #include <unistd.h> #include <errno.h> #include <fcntl.h> @@ -173,7 +177,7 @@ void SvpSalInstance::Wakeup(SvpRequest const request) pSVData->mpWakeCallback(pSVData->mpPollClosure); SvpSalYieldMutex *const pMutex(static_cast<SvpSalYieldMutex*>(GetYieldMutex())); - std::unique_lock<std::mutex> g(pMutex->m_WakeUpMainMutex); + std::scoped_lock<std::mutex> g(pMutex->m_WakeUpMainMutex); if (request != SvpRequest::NONE) pMutex->m_Request = request; pMutex->m_wakeUpMain = true; @@ -373,7 +377,7 @@ sal_uInt32 SvpSalYieldMutex::doRelease(bool const bUnlockAll) } else { - std::unique_lock<std::mutex> g(m_WakeUpMainMutex); + std::scoped_lock<std::mutex> g(m_WakeUpMainMutex); m_wakeUpMain = true; m_WakeUpMainCond.notify_one(); } diff --git a/vcl/inc/osx/runinmain.hxx b/vcl/inc/osx/runinmain.hxx index 287479981aa3..e68bc4d35010 100644 --- a/vcl/inc/osx/runinmain.hxx +++ b/vcl/inc/osx/runinmain.hxx @@ -72,7 +72,7 @@ union RuninmainResult DBG_TESTSOLARMUTEX(); \ SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ { \ - std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ assert( !aMutex->m_aCodeBlock ); \ aMutex->m_aCodeBlock = Block_copy(^{ \ command; \ @@ -98,7 +98,7 @@ union RuninmainResult DBG_TESTSOLARMUTEX(); \ SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ { \ - std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ assert( !aMutex->m_aCodeBlock ); \ aMutex->m_aCodeBlock = Block_copy(^{ \ aMutex->m_aResult.pointer = static_cast<void*>( command ); \ @@ -124,7 +124,7 @@ union RuninmainResult DBG_TESTSOLARMUTEX(); \ SalYieldMutex *aMutex = static_cast<SalYieldMutex*>(instance->GetYieldMutex()); \ { \ - std::unique_lock<std::mutex> g(aMutex->m_runInMainMutex); \ + std::scoped_lock<std::mutex> g(aMutex->m_runInMainMutex); \ assert( !aMutex->m_aCodeBlock ); \ aMutex->m_aCodeBlock = Block_copy(^{ \ aMutex->m_aResult.member = command; \ diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index b31f870d9e12..6ed28b7a1d5a 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -232,7 +232,7 @@ void SalYieldMutex::doAcquire( sal_uInt32 nLockCount ) block(); pInst->mbNoYieldLock = false; Block_release( block ); - std::unique_lock<std::mutex> g(m_runInMainMutex); + std::scoped_lock<std::mutex> g(m_runInMainMutex); assert(!m_resultReady); m_resultReady = true; m_aResultCondition.notify_all(); @@ -255,7 +255,7 @@ sal_uInt32 SalYieldMutex::doRelease( const bool bUnlockAll ) return 1; sal_uInt32 nCount; { - std::unique_lock<std::mutex> g(m_runInMainMutex); + std::scoped_lock<std::mutex> g(m_runInMainMutex); // read m_nCount before doRelease bool const isReleased(bUnlockAll || m_nCount == 1); nCount = comphelper::SolarMutex::doRelease( bUnlockAll ); diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index d657ab729801..6c872b84cb0a 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -132,7 +132,7 @@ void Qt5YieldMutex::doAcquire(sal_uInt32 nLockCount) m_bNoYieldLock = true; // execute closure with borrowed SolarMutex func(); m_bNoYieldLock = false; - std::unique_lock<std::mutex> g(m_RunInMainMutex); + std::scoped_lock<std::mutex> g(m_RunInMainMutex); assert(!m_isResultReady); m_isResultReady = true; m_ResultCondition.notify_all(); // unblock other thread @@ -150,7 +150,7 @@ sal_uInt32 Qt5YieldMutex::doRelease(bool const bUnlockAll) return 1; // dummy value } - std::unique_lock<std::mutex> g(m_RunInMainMutex); + std::scoped_lock<std::mutex> g(m_RunInMainMutex); // read m_nCount before doRelease (it's guarded by m_aMutex) bool const isReleased(bUnlockAll || m_nCount == 1); sal_uInt32 nCount = SalYieldMutex::doRelease(bUnlockAll); @@ -177,7 +177,7 @@ void Qt5Instance::RunInMainThread(std::function<void()> func) Qt5YieldMutex* const pMutex(static_cast<Qt5YieldMutex*>(GetYieldMutex())); { - std::unique_lock<std::mutex> g(pMutex->m_RunInMainMutex); + std::scoped_lock<std::mutex> g(pMutex->m_RunInMainMutex); assert(!pMutex->m_Closure); pMutex->m_Closure = func; // unblock main thread in case it is blocked on condition |