Functions | |
| 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. | |
| switch_status_t | switch_core_timer_next (switch_timer_t *timer) |
| Wait for one cycle on an existing timer. | |
| switch_status_t | switch_core_timer_step (switch_timer_t *timer) |
| Step the timer one step. | |
| switch_status_t | switch_core_timer_sync (switch_timer_t *timer) |
| switch_status_t | switch_core_timer_check (switch_timer_t *timer, switch_bool_t step) |
| Check if the current step has been exceeded. | |
| switch_status_t | switch_core_timer_destroy (switch_timer_t *timer) |
| Destroy an allocated timer. | |
|
||||||||||||
|
Check if the current step has been exceeded.
00105 {
00106 if (!timer->timer_interface || !timer->timer_interface->timer_check) {
00107 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured.\n");
00108 return SWITCH_STATUS_GENERR;
00109 }
00110
00111 return timer->timer_interface->timer_check(timer, step);
00112 }
|
Here is the call graph for this function:

|
|
Destroy an allocated timer.
00116 {
00117 if (!timer->timer_interface || !timer->timer_interface->timer_destroy) {
00118 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured.\n");
00119 return SWITCH_STATUS_GENERR;
00120 }
00121
00122 timer->timer_interface->timer_destroy(timer);
00123
00124 if (switch_test_flag(timer, SWITCH_TIMER_FLAG_FREE_POOL)) {
00125 switch_core_destroy_memory_pool(&timer->memory_pool);
00126 }
00127
00128 return SWITCH_STATUS_SUCCESS;
00129 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Request a timer handle using given time module.
00040 {
00041 switch_timer_interface_t *timer_interface;
00042 switch_status_t status;
00043 memset(timer, 0, sizeof(*timer));
00044 if ((timer_interface = switch_loadable_module_get_timer_interface(timer_name)) == 0 || !timer_interface->timer_init) {
00045 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid timer %s!\n", timer_name);
00046 return SWITCH_STATUS_GENERR;
00047 }
00048
00049 timer->interval = interval;
00050 timer->samples = samples;
00051 timer->samplecount = 0;
00052 timer->timer_interface = timer_interface;
00053
00054 if (pool) {
00055 timer->memory_pool = pool;
00056 } else {
00057 if ((status = switch_core_new_memory_pool(&timer->memory_pool)) != SWITCH_STATUS_SUCCESS) {
00058 return status;
00059 }
00060 switch_set_flag(timer, SWITCH_TIMER_FLAG_FREE_POOL);
00061 }
00062
00063 timer->timer_interface->timer_init(timer);
00064 return SWITCH_STATUS_SUCCESS;
00065
00066 }
|
Here is the call graph for this function:

|
|
Wait for one cycle on an existing timer.
00069 {
00070 if (!timer->timer_interface || !timer->timer_interface->timer_next) {
00071 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured.\n");
00072 return SWITCH_STATUS_GENERR;
00073 }
00074
00075 if (timer->timer_interface->timer_next(timer) == SWITCH_STATUS_SUCCESS) {
00076 return SWITCH_STATUS_SUCCESS;
00077 } else {
00078 return SWITCH_STATUS_GENERR;
00079 }
00080
00081 }
|
Here is the call graph for this function:

|
|
Step the timer one step.
00084 {
00085 if (!timer->timer_interface || !timer->timer_interface->timer_step) {
00086 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured.\n");
00087 return SWITCH_STATUS_GENERR;
00088 }
00089
00090 return timer->timer_interface->timer_step(timer);
00091 }
|
Here is the call graph for this function:

|
|
00095 {
00096 if (!timer->timer_interface || !timer->timer_interface->timer_sync) {
00097 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured.\n");
00098 return SWITCH_STATUS_GENERR;
00099 }
00100
00101 return timer->timer_interface->timer_sync(timer);
00102 }
|
Here is the call graph for this function:

1.3.9.1