VLC
4.0.0-dev
|
Macros | |
#define | VLC_TIMER_DISARM (0) |
#define | VLC_TIMER_FIRE_ONCE (0) |
Typedefs | |
typedef struct vlc_timer * | vlc_timer_t |
Threaded timer handle. More... | |
Functions | |
VLC_EXPORT int | vlc_timer_create (vlc_timer_t *id, void(*func)(void *), void *data) |
Initializes an asynchronous timer. More... | |
VLC_EXPORT void | vlc_timer_destroy (vlc_timer_t timer) |
Destroys an initialized timer. More... | |
VLC_EXPORT void | vlc_timer_schedule (vlc_timer_t timer, bool absolute, vlc_tick_t value, vlc_tick_t interval) |
Arms or disarms an initialized timer. More... | |
static void | vlc_timer_disarm (vlc_timer_t timer) |
static void | vlc_timer_schedule_asap (vlc_timer_t timer, vlc_tick_t interval) |
VLC_EXPORT unsigned | vlc_timer_getoverrun (vlc_timer_t) |
Fetches and resets the overrun counter for a timer. More... | |
#define VLC_TIMER_DISARM (0) |
#define VLC_TIMER_FIRE_ONCE (0) |
typedef struct vlc_timer* vlc_timer_t |
Threaded timer handle.
VLC_EXPORT int vlc_timer_create | ( | vlc_timer_t * | id, |
void(*)(void *) | func, | ||
void * | data | ||
) |
Initializes an asynchronous timer.
id | pointer to timer to be initialized |
func | function that the timer will call |
data | parameter for the timer function |
References vlc_timer::data, vlc_timer::func, vlc_timer::hev, vlc_timer::htimer, vlc_timer::interval, vlc_timer::live, vlc_timer::lock, vlc_timer::overruns, vlc_timer::quit, vlc_timer::reschedule, vlc_timer::thread, vlc_timer::tid, unlikely, vlc_timer::value, vlc_clone(), vlc_cond_init(), vlc_mutex_init(), VLC_THREAD_PRIORITY_INPUT, vlc_timer_do(), and vlc_timer_thread().
VLC_EXPORT void vlc_timer_destroy | ( | vlc_timer_t | timer | ) |
Destroys an initialized timer.
If needed, the timer is first disarmed. Behaviour is undefined if the specified timer is not initialized.
timer | timer to destroy |
References vlc_timer::handle, vlc_timer::hev, vlc_timer::htimer, vlc_timer::live, vlc_timer::lock, vlc_timer::quit, vlc_timer::reschedule, vlc_timer::thread, vlc_timer::tid, vlc_cond_signal(), vlc_join(), vlc_mutex_lock(), and vlc_mutex_unlock().
|
inlinestatic |
References VLC_TIMER_DISARM, and vlc_timer_schedule().
VLC_EXPORT unsigned vlc_timer_getoverrun | ( | vlc_timer_t | ) |
Fetches and resets the overrun counter for a timer.
This functions returns the number of times that the interval timer should have fired, but the callback was not invoked due to scheduling problems. The call resets the counter to zero.
timer | initialized timer |
References vlc_timer::overruns.
VLC_EXPORT void vlc_timer_schedule | ( | vlc_timer_t | timer, |
bool | absolute, | ||
vlc_tick_t | value, | ||
vlc_tick_t | interval | ||
) |
Arms or disarms an initialized timer.
This functions overrides any previous call to itself.
timer | initialized timer |
absolute | the timer value origin is the same as vlc_tick_now() if true, the timer value is relative to now if false. |
value | zero to disarm the timer, otherwise the initial time to wait before firing the timer. |
interval | zero to fire the timer just once, otherwise the timer repetition interval. |
References vlc_timer::handle, vlc_timer::hev, vlc_timer::htimer, vlc_timer::interval, vlc_timer::lock, MS_FROM_VLC_TICK, vlc_timer::reschedule, vlc_timer::value, vlc_cond_signal(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_tick_now(), VLC_TIMER_DISARM, and vlc_timer_do().
Referenced by vlc_timer_disarm(), and vlc_timer_schedule_asap().
|
inlinestatic |
References vlc_timer_schedule().