21#include <osl/thread.hxx>
22#include <osl/conditn.hxx>
44 virtual void SAL_CALL
run()
override;
107 getTimerManager().registerTimer(
this);
113 getTimerManager().unregisterTimer(
this);
118 return getTimerManager().lookupTimer(
this);
125 osl_getSystemTime(&Now);
172 osl_getSystemTime(&Now);
174 sal_Int32 secs =
m_aExpired.Seconds - Now.Seconds;
179 sal_Int32 nsecs =
m_aExpired.Nanosec - Now.Nanosec;
219 std::lock_guard Guard(
m_Lock);
232 ppIter= &((*ppIter)->m_pNext);
255 std::lock_guard Guard(
m_Lock);
261 if (pTimer == (*ppIter))
267 ppIter= &((*ppIter)->m_pNext);
277 std::lock_guard Guard(
m_Lock);
291 std::unique_lock aLock (
m_Lock);
317 osl_getSystemTime(&Now);
331 osl_setThreadName(
"salhelper::TimerManager");
333 setPriority( osl_Thread_PriorityBelowNormal );
341 std::lock_guard a_Guard(
m_Lock);
Timer(const char *pDebugName)
osl::Condition m_notEmpty
Signal the insertion of a timer.
bool lookupTimer(const salhelper::Timer *pTimer)
lookup timer
salhelper::Timer * m_pHead
sorted-queue data
std::mutex m_Lock
List Protection.
TimerManager()
The timer manager cleanup has been removed (no thread is killed anymore), so the thread leaks.
virtual void SAL_CALL run() override
worker-function of thread
void unregisterTimer(salhelper::Timer const *pTimer)
unregister timer
void checkForTimeout()
Checking and triggering of a timer event.
void registerTimer(salhelper::Timer *pTimer)
register timer
Interface for the Timer and handling the event.
TTimeValue SAL_CALL getRemainingTime() const
Returns the remaining time before timer expiration relative to now.
virtual ~Timer() SAL_OVERRIDE
Destructor.
void SAL_CALL start()
Start timer.
virtual void SAL_CALL onShot()=0
What should be done when the 'timer fires'.
TTimeValue m_aTimeOut
holds (initial) expiration time of this timer.
void SAL_CALL stop()
Abort timer prematurely.
sal_Bool SAL_CALL isExpired() const
Is the timer expired?
sal_Bool SAL_CALL expiresBefore(const Timer *pTimer) const
Does pTimer expires before us?
Timer * m_pNext
Pointer to the next timer (to fire).
void SAL_CALL setAbsoluteTime(const TTimeValue &Time)
Set the absolute time when the timer should fire.
TTimeValue m_aExpired
holds the time of expiration of this timer.
void SAL_CALL setRemainingTime(const TTimeValue &Remaining)
Set the time to fire to 'now' + Remaining.
TTimeValue m_aRepeatDelta
holds the time interveal of successive expirations.
void SAL_CALL addTime(const TTimeValue &Time)
Adds Time to the 'fire time'.
sal_Bool SAL_CALL isTicking() const
Returns sal_True if timer is running.
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
Helper class for easier manipulation with TimeValue.
void SAL_CALL normalize()
bool SAL_CALL isEmpty() const
void SAL_CALL addTime(const TTimeValue &Delta)