|
AceSmartSoft API Documentation
|
single/continuous timer. More...
#include <smartTimerManagerThread.hh>
Public Member Functions | |
| TimerManagerThread () | |
| Constructor. More... | |
| virtual | ~TimerManagerThread () |
| Destructor. Properly shuts down the timer thread. More... | |
| virtual TimerId | scheduleTimer (Smart::ITimerHandler *handler, const void *act, const Smart::Duration &first_time, const Smart::Duration &interval=Smart::Duration::zero()) override |
| Schedule a timer. More... | |
| virtual int | cancelTimer (const TimerId &timer_id, const void **act=0) override |
| Cancel a single timer. More... | |
| virtual int | cancelTimersOf (Smart::ITimerHandler *handler) override |
| Cancel all timers associated with a handler. More... | |
| virtual void | deleteAllTimers () override |
| virtual int | resetTimerInterval (const TimerId &timer_id, const Smart::Duration &interval) override |
| Resets the interval of a timer. More... | |
| int | startTimerThread () |
| Start execution of the internal timer thread. More... | |
| int | startTimerThread (const ACE_Sched_Params &sched_params, const int &cpuAffinity=-1) |
| Start execution of the internal timer thread. More... | |
| void | shutdownTimer (const bool &waitOnCompletion=true) |
| Initializes timer thread to permanently shutdown. More... | |
Protected Member Functions | |
| virtual int | svc (void) |
| Run by a daemon thread to handle deferred processing. More... | |
| int | setSchedParams (const ACE_Sched_Params &sched_params) |
| int | setCpuAffinity (const int &cpuCore) |
Protected Attributes | |
| TimerHeap | timer_queue |
| std::set< Smart::ITimerHandler * > | handlers |
| ACE_Auto_Event | timer_event_ |
| Event to wait on. More... | |
| int | shutting_down_ |
| Flag used to indicate when we are shutting down. More... | |
single/continuous timer.
This object has a thread that waits on the earliest time in a list of timers and an event. When a timer expires, the apropriate handler is called in the context of this thread.
It is based on ACE_Time_Heap and friends.
Some code taken from ace/Proactor.cpp
| SmartACE::TimerManagerThread::TimerManagerThread | ( | ) |
Constructor.
|
virtual |
Destructor. Properly shuts down the timer thread.
|
overridevirtual |
Cancel a single timer.
| timer_id | to cancel |
| act | pointer to retrive the act that was given on scheduleTimer(). Can be used to release ressources owned by act. If act == 0, nothing is retrieved. |
|
overridevirtual |
Cancel all timers associated with a handler.
| handler | cancel timers associated with this handler |
|
overridevirtual |
|
overridevirtual |
Resets the interval of a timer.
| timer_id | to change |
| interval | new timer interval (relative to the current time) |
|
overridevirtual |
Schedule a timer.
| handler | The handler that will be called when the timer expires. |
| act | a value that will be passed to the handler. |
| first_time | relative time for the first timer expiration |
| interval | Interval for periodic timers. A single shot timer is scheduled by default. |
|
protected |
|
protected |
| void SmartACE::TimerManagerThread::shutdownTimer | ( | const bool & | waitOnCompletion = true | ) |
Initializes timer thread to permanently shutdown.
| waitOnCompletion | indicates, whether this method should block until timer is completely down |
| int SmartACE::TimerManagerThread::startTimerThread | ( | ) |
Start execution of the internal timer thread.
| int SmartACE::TimerManagerThread::startTimerThread | ( | const ACE_Sched_Params & | sched_params, |
| const int & | cpuAffinity = -1 |
||
| ) |
Start execution of the internal timer thread.
| sched_params | initializes a specific scheduler |
| cpuAffinity | assigns the thread to one specific CPU core |
|
protectedvirtual |
Run by a daemon thread to handle deferred processing.
In other words, this method will do the waiting on the earliest timer and event.
|
protected |
|
protected |
Flag used to indicate when we are shutting down.
|
protected |
Event to wait on.
|
protected |
1.8.13