summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-09-29 21:02:17 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-10-04 14:53:33 +0200
commitda5cdcdeddf7bc21606b4cb64d8b1fc412146935 (patch)
treee887175264e671a241e735763100e40adaa15e7c /vcl/win
parent96e67461c8b451f3a313bcc973ac49c5e49537c0 (diff)
Convert tick-based timer events to versioned ones
Instead of storing the system ticks in the timer event message simply store a version. Moves the version handling code into a VersionedEvent class, inherited by WinSalTimer and AquaSalTimer. Change-Id: I5add85031d36b3424a26a9ef798294cbfb00b2e4 Reviewed-on: https://gerrit.libreoffice.org/42959 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/app/saltimer.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 62fe620b5522..c75b7534e718 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -19,8 +19,6 @@
#include <sal/config.h>
-#include <tools/time.hxx>
-
#include <svsys.h>
#include <win/saldata.hxx>
#include <win/saltimer.h>
@@ -46,8 +44,9 @@ void WinSalTimer::ImplStop()
return;
m_nTimerId = nullptr;
- m_nTimerStartTicks = 0;
DeleteTimerQueueTimer( nullptr, hTimer, INVALID_HANDLE_VALUE );
+ // Keep both after DeleteTimerQueueTimer, because they are set in SalTimerProc
+ InvalidateEvent();
m_bPollForMessage = false;
// remove as many pending SAL_MSG_TIMER_CALLBACK messages as possible
@@ -71,19 +70,17 @@ void WinSalTimer::ImplStart( sal_uLong nMS )
// keep the yield running, if a 0ms Idle is scheduled
m_bPollForMessage = ( 0 == nMS );
- m_nTimerStartTicks = tools::Time::GetMonotonicTicks() % SAL_MAX_UINT32;
// probably WT_EXECUTEONLYONCE is not needed, but it enforces Period
// to be 0 and should not hurt; also see
// https://www.microsoft.com/msj/0499/pooling/pooling.aspx
CreateTimerQueueTimer(&m_nTimerId, nullptr, SalTimerProc,
reinterpret_cast<void*>(
- sal_uIntPtr(m_nTimerStartTicks)),
+ sal_IntPtr(GetNextEventVersion())),
nMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
}
WinSalTimer::WinSalTimer()
: m_nTimerId( nullptr )
- , m_nTimerStartTicks( 0 )
, m_bPollForMessage( false )
{
}
@@ -119,11 +116,10 @@ void WinSalTimer::Stop()
ImplStop();
}
-/** This gets invoked from a Timer Queue thread.
-
-Don't acquire the SolarMutex to avoid deadlocks, just wake up the main thread
-at better resolution than 10ms.
-*/
+/**
+ * This gets invoked from a Timer Queue thread.
+ * Don't acquire the SolarMutex to avoid deadlocks.
+ */
static void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
{
__try