43 memset(timer, 0,
sizeof(*timer));
49 timer->interval = interval;
50 timer->samples = samples;
51 timer->samplecount = samples;
52 timer->timer_interface = timer_interface;
55 timer->memory_pool =
pool;
64 return timer->timer_interface->timer_init(timer);
69 if (!timer->timer_interface || !timer->timer_interface->timer_next) {
84 if (!timer->timer_interface || !timer->timer_interface->timer_step) {
89 return timer->timer_interface->timer_step(timer);
95 if (!timer->timer_interface || !timer->timer_interface->timer_sync) {
100 return timer->timer_interface->timer_sync(timer);
105 if (!timer->timer_interface || !timer->timer_interface->timer_check) {
110 return timer->timer_interface->timer_check(timer, step);
116 if (!timer->timer_interface || !timer->timer_interface->timer_destroy) {
121 timer->timer_interface->timer_destroy(timer);
128 memset(timer, 0,
sizeof(*timer));
switch_timer_interface_t * switch_loadable_module_get_timer_interface(const char *name)
Retrieve the timer interface by it's registered name.
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_status_t switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool)
Request a timer handle using given time module.
#define SWITCH_CHANNEL_LOG
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
switch_memory_pool_t * pool
switch_status_t switch_core_timer_step(switch_timer_t *timer)
Step the timer one step.
switch_status_t switch_core_timer_check(switch_timer_t *timer, switch_bool_t step)
Check if the current step has been exceeded.
A table of functions that a timer module implements.
Abstract handler to a timer module.
#define UNPROTECT_INTERFACE(_it)
switch_status_t(* timer_init)(switch_timer_t *)
switch_status_t switch_core_timer_destroy(switch_timer_t *timer)
Destroy an allocated timer.
switch_status_t switch_core_timer_next(switch_timer_t *timer)
Wait for one cycle on an existing timer.
switch_status_t
Common return values.
struct apr_pool_t switch_memory_pool_t
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
switch_status_t switch_core_timer_sync(switch_timer_t *timer)