Manage threads that start at a given time (for internal use only). More...
Include dependency graph for TimerThread.cpp:Go to the source code of this file.
Classes | |
| struct | anonymous_namespace{TimerThread.cpp}::TimerEvent |
| Structure to contain information for a timer event. More... | |
Macros | |
| #define | INVALID_EVENT_ID (-10 & 1 << 29) |
| Invalid event ID. | |
Functions | |
| int | TimerThreadInit (TimerThread *timer, ThreadPool *tp) |
| Initializes and starts timer thread. | |
| int | TimerThreadSchedule (TimerThread *timer, time_t timeout, TimeoutType type, ThreadPoolJob *job, Duration duration, int *id) |
| Schedules an event to run at a specified time. | |
| int | TimerThreadRemove (TimerThread *timer, int id, ThreadPoolJob *out) |
| Removes an event from the timer Q. | |
| int | TimerThreadShutdown (TimerThread *timer) |
| Shutdown the timer thread. | |
Scope restricted to file | |
| TimerEvent * | anonymous_namespace{TimerThread.cpp}::CreateTimerEvent (TimerThread *timer, ThreadPoolJob *job, Duration persistent, time_t eventTime, int id) |
| Creates a Timer Event. | |
| void | anonymous_namespace{TimerThread.cpp}::FreeTimerEvent (TimerThread *timer, TimerEvent *event) |
| Deallocates a dynamically allocated TimerEvent. | |
| void | anonymous_namespace{TimerThread.cpp}::TimerThreadWorker (void *arg) |
| Implements timer thread. | |
| int | anonymous_namespace{TimerThread.cpp}::CalculateEventTime (time_t *timeout, TimeoutType type) |
| Calculates the appropriate timeout in absolute seconds since Jan 1, 1970. | |
Manage threads that start at a given time (for internal use only).
Because this is for internal use, parameters are NOT checked for validity. The caller must ensure valid parameters.
Definition in file TimerThread.cpp.
| struct anonymous_namespace{TimerThread.cpp}::TimerEvent |
Structure to contain information for a timer event.
Internal to the TimerThread.
Definition at line 58 of file TimerThread.cpp.
Collaboration diagram for anonymous_namespace{TimerThread.cpp}::TimerEvent:| Class Members | ||
|---|---|---|
| ThreadPoolJob | job | |
| time_t | eventTime |
Absolute time for event in seconds since Jan 1, 1970. |
| Duration | persistent |
Long term or short term job. |
| int | id |
Id of timer event. (can be null?). |
| #define INVALID_EVENT_ID (-10 & 1 << 29) |
Invalid event ID.
Definition at line 49 of file TimerThread.cpp.
| int TimerThreadInit | ( | TimerThread * | timer, |
| ThreadPool * | tp | ||
| ) |
Initializes and starts timer thread.
| [in] | timer | Valid timer thread pointer. |
| [in] | tp | Valid thread pool to use. Must be started. Must be valid for lifetime of timer. Timer must be shutdown BEFORE thread pool. |
Definition at line 221 of file TimerThread.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int TimerThreadSchedule | ( | TimerThread * | timer, |
| time_t | timeout, | ||
| TimeoutType | type, | ||
| ThreadPoolJob * | job, | ||
| Duration | duration, | ||
| int * | id | ||
| ) |
Schedules an event to run at a specified time.
| [in] | timer | Valid timer thread pointer. |
| [in] | timeout | time of event. Either in absolute seconds, or relative seconds in the future. |
| [in] | type | either ABS_SEC, or REL_SEC. If REL_SEC, then the event will be scheduled at the current time + REL_SEC. |
| [in] | job | Valid Thread pool job with following fields. |
| [in] | duration | |
| [out] | id | Id of timer event. (can be null). |
Definition at line 276 of file TimerThread.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int TimerThreadRemove | ( | TimerThread * | timer, |
| int | id, | ||
| ThreadPoolJob * | out | ||
| ) |
Removes an event from the timer Q.
Events can only be removed before they have been placed in the thread pool.
| [in] | timer | Valid timer thread pointer. |
| [in] | id | Id of event to remove. |
| [out] | out | Thread pool job. |
Definition at line 339 of file TimerThread.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| int TimerThreadShutdown | ( | TimerThread * | timer | ) |
Shutdown the timer thread.
Events scheduled in the future will NOT be run. Timer thread should be shutdown BEFORE it's associated thread pool.
| [in] | timer | Valid timer thread pointer. |
Definition at line 372 of file TimerThread.cpp.
Here is the call graph for this function:
Here is the caller graph for this function: