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 | |
int | vlc_timer_create (vlc_timer_t *id, void(*func)(void *), void *data) |
Initializes an asynchronous timer. More... | |
void | vlc_timer_destroy (vlc_timer_t timer) |
Destroys an initialized timer. More... | |
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) |
unsigned | vlc_timer_getoverrun (vlc_timer_t timer) |
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.
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::t, vlc_timer::thread, vlc_timer::tid, timer_callback(), unlikely, vlc_timer::value, vlc_clone(), vlc_cond_init(), vlc_mutex_init(), vlc_once_begin, vlc_once_complete(), vlc_timer_do(), and vlc_timer_thread().
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::hev, vlc_timer::htimer, vlc_timer::live, vlc_timer::lock, vlc_timer::quit, vlc_timer::reschedule, vlc_timer::t, 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().
unsigned vlc_timer_getoverrun | ( | vlc_timer_t | timer | ) |
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.
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::hev, vlc_timer::htimer, vlc_timer::interval, vlc_timer::lock, MS_FROM_VLC_TICK, MSFTIME_FROM_VLC_TICK, vlc_timer::reschedule, vlc_timer::t, unlikely, vlc_timer::value, vlc_cond_signal(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_tick_now(), VLC_TIMER_DISARM, and VLC_TIMER_FIRE_ONCE.
Referenced by vlc_timer_disarm(), and vlc_timer_schedule_asap().
|
inlinestatic |
References vlc_timer_schedule().