FreeSWITCH API Documentation
1.7.0
|
Data Structures | |
struct | switch_scheduler_task |
Functions | |
uint32_t | switch_scheduler_add_task (time_t task_runtime, switch_scheduler_func_t func, const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags) |
Schedule a task in the future. More... | |
uint32_t | switch_scheduler_del_task_id (uint32_t task_id) |
Delete a scheduled task. More... | |
uint32_t | switch_scheduler_del_task_group (const char *group) |
Delete a scheduled task based on the group name. More... | |
void | switch_scheduler_task_thread_start (void) |
Start the scheduler system. More... | |
void | switch_scheduler_task_thread_stop (void) |
Stop the scheduler system. More... | |
uint32_t switch_scheduler_add_task | ( | time_t | task_runtime, |
switch_scheduler_func_t | func, | ||
const char * | desc, | ||
const char * | group, | ||
uint32_t | cmd_id, | ||
void * | cmd_arg, | ||
switch_scheduler_flag_t | flags | ||
) |
Schedule a task in the future.
task_runtime | the time in epoch seconds to execute the task. |
func | the callback function to execute when the task is executed. |
desc | an arbitrary description of the task. |
group | a group id tag to link multiple tasks to a single entity. |
cmd_id | an arbitrary index number be used in the callback. |
cmd_arg | user data to be passed to the callback. |
flags | flags to alter behaviour |
Definition at line 208 of file switch_scheduler.c.
References switch_scheduler_task::cmd_arg, switch_scheduler_task::cmd_id, switch_scheduler_task::created, switch_scheduler_task_container::desc, switch_scheduler_task_container::flags, switch_scheduler_task_container::func, globals, switch_scheduler_task::group, switch_scheduler_task::hash, switch_scheduler_task_container::next, switch_scheduler_task::repeat, switch_scheduler_task::runtime, switch_assert, SWITCH_CHANNEL_LOG, switch_ci_hashfunc_default(), switch_epoch_time_now(), switch_event_add_header(), switch_event_add_header_string(), SWITCH_EVENT_ADD_SCHEDULE, switch_event_create, SWITCH_INT64_T_FMT, SWITCH_LOG_DEBUG, switch_log_printf(), switch_mutex_lock(), switch_mutex_unlock(), switch_queue_push(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_SUCCESS, switch_str_nil, switch_zmalloc, switch_scheduler_task_container::task, and switch_scheduler_task::task_id.
Referenced by switch_core_init(), switch_core_session_sched_heartbeat(), switch_ivr_schedule_broadcast(), switch_ivr_schedule_hangup(), switch_ivr_schedule_transfer(), switch_nat_late_init(), and switch_rtp_init().
uint32_t switch_scheduler_del_task_group | ( | const char * | group | ) |
Delete a scheduled task based on the group name.
group | the group name |
Definition at line 293 of file switch_scheduler.c.
References switch_scheduler_task_container::destroyed, globals, switch_scheduler_task::group, switch_scheduler_task::hash, hash, switch_scheduler_task_container::next, SSHF_NO_DEL, SWITCH_CHANNEL_LOG, switch_ci_hashfunc_default(), switch_log_printf(), SWITCH_LOG_WARNING, switch_mutex_lock(), switch_mutex_unlock(), switch_test_flag, switch_scheduler_task_container::task, switch_scheduler_task::task_id, and zstr.
Referenced by switch_core_session_perform_destroy().
uint32_t switch_scheduler_del_task_id | ( | uint32_t | task_id | ) |
Delete a scheduled task.
task_id | the id of the task |
Definition at line 263 of file switch_scheduler.c.
References switch_scheduler_task_container::destroyed, globals, switch_scheduler_task::group, switch_scheduler_task_container::next, switch_scheduler_task_container::running, SSHF_NO_DEL, SWITCH_CHANNEL_LOG, switch_log_printf(), SWITCH_LOG_WARNING, switch_mutex_lock(), switch_mutex_unlock(), switch_test_flag, switch_scheduler_task_container::task, and switch_scheduler_task::task_id.
Referenced by switch_core_session_unsched_heartbeat().
void switch_scheduler_task_thread_start | ( | void | ) |
Start the scheduler system.
Definition at line 328 of file switch_scheduler.c.
References globals, switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, switch_queue_create(), switch_scheduler_task_thread(), switch_thread_create(), switch_threadattr_create(), and task_thread_p.
Referenced by switch_core_init().
void switch_scheduler_task_thread_stop | ( | void | ) |
Stop the scheduler system.
Definition at line 341 of file switch_scheduler.c.
References globals, SWITCH_CHANNEL_LOG, switch_core_destroy_memory_pool, SWITCH_LOG_CONSOLE, switch_log_printf(), switch_thread_join(), switch_yield, and task_thread_p.
Referenced by switch_core_destroy().