|
libUPnP
1.6.17
|


Go to the source code of this file.
Data Structures | |
| struct | TIMERTHREAD |
| struct | TIMEREVENT |
Macros | |
| #define | INVALID_EVENT_ID (-10 & 1<<29) |
Typedefs | |
| typedef enum timeoutType | TimeoutType |
| typedef struct TIMERTHREAD | TimerThread |
| typedef struct TIMEREVENT | TimerEvent |
Enumerations | |
| enum | timeoutType { ABS_SEC, REL_SEC } |
Functions | |
| int | TimerThreadInit (TimerThread *timer, ThreadPool *tp) |
| Initializes and starts timer thread. More... | |
| int | TimerThreadSchedule (TimerThread *timer, time_t time, TimeoutType type, ThreadPoolJob *job, Duration duration, int *id) |
| Schedules an event to run at a specified time. More... | |
| int | TimerThreadRemove (TimerThread *timer, int id, ThreadPoolJob *out) |
| Removes an event from the timer Q. More... | |
| int | TimerThreadShutdown (TimerThread *timer) |
| Shutdown the timer thread. More... | |
| typedef enum timeoutType TimeoutType |
Timeout Types.
| typedef struct TIMEREVENT TimerEvent |
Struct to contain information for a timer event.
Internal to the TimerThread.
| typedef struct TIMERTHREAD TimerThread |
A timer thread similar to the one in the Upnp SDK that allows the scheduling of a job to run at a specified time in the future.
Because the timer thread uses the thread pool there is no gurantee of timing, only approximate timing.
Uses ThreadPool, Mutex, Condition, Thread.
| enum timeoutType |
| 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. |
References FreeListDestroy(), FreeListInit(), ListDestroy(), ListInit(), ThreadPoolAddPersistent(), TimerThreadWorker(), TPJobInit(), and TPJobSetPriority().
Referenced by UpnpInitPreamble().
| 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. |
| [in] | out | Space for thread pool job. |
References FreeTimerEvent(), ListDelNode(), ListHead(), and ListNext().
Referenced by free_client_subscription(), and genaRenewSubscription().
| int TimerThreadSchedule | ( | TimerThread * | timer, |
| time_t | time, | ||
| TimeoutType | type, | ||
| ThreadPoolJob * | job, | ||
| Duration | duration, | ||
| int * | id | ||
| ) |
Schedules an event to run at a specified time.
| [in] | timer | Valid timer thread pointer. |
| [in] | time | 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 | . |
| [in] | id | Id of timer event. (out, can be null). |
References CalculateEventTime(), CreateTimerEvent(), TIMEREVENT::eventTime, FreeTimerEvent(), ListAddBefore(), ListAddTail(), ListHead(), and ListNext().
Referenced by ScheduleGenaAutoRenew(), SearchByTarget(), ssdp_handle_device_request(), and UpnpSendAdvertisementLowPower().
| 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. |
References FreeListDestroy(), FreeTimerEvent(), ListDelNode(), ListDestroy(), ListHead(), and ListNext().
Referenced by UpnpFinish().
1.8.3.1