diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-01-23 11:56:41 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-07-13 12:10:20 +0200 |
commit | c0710abfebd320903a3edb23d4b1441ea351b0be (patch) | |
tree | d0a02eceed8c830cfc7a1da2bc7d14d70c8a69aa /vcl/win | |
parent | dc63cc326ee5757124cef45e470d290e6e32002e (diff) |
Add some Scheduler unit tests and logging
1. calling Start() for invoked tasks
2. correctly schedule by priority
3. self-stopping AutoTimer
This also adds SAL_INFO output to Scheduler and Task to log the
scheduling processing tasks.
Change-Id: I3c8a708d1fd51c550320f8af3f9486c43c32e358
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/app/salinst.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 78147ae67608..1fbdda70b261 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -188,10 +188,7 @@ void ImplSalYieldMutexAcquireWithWait() if ( !pInst ) return; - DWORD nThreadId = GetCurrentThreadId(); - SalData* pSalData = GetSalData(); - - if ( pSalData->mnAppThreadId == nThreadId ) + if ( pInst->IsMainThread() ) { // tdf#96887 If this is the main thread, then we must wait for two things: // - the mpSalYieldMutex being freed @@ -594,13 +591,18 @@ ImplSalYield( bool bWait, bool bHandleAllCurrentEvents ) SalYieldResult::TIMEOUT; } +bool WinSalInstance::IsMainThread() const +{ + const SalData* pSalData = GetSalData(); + return pSalData->mnAppThreadId == GetCurrentThreadId(); +} + SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong const nReleased) { SalYieldResult eDidWork = SalYieldResult::TIMEOUT; // NOTE: if nReleased != 0 this will be called without SolarMutex // so don't do anything dangerous before releasing it here SalYieldMutex* pYieldMutex = mpSalYieldMutex; - SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); sal_uLong const nCount = (nReleased != 0) ? nReleased @@ -611,7 +613,7 @@ SalYieldResult WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, pYieldMutex->release(); n--; } - if ( pSalData->mnAppThreadId != nCurThreadId ) + if ( !IsMainThread() ) { // #97739# A SendMessage call blocks until the called thread (here: the main thread) // returns. During a yield however, messages are processed in the main thread that might |