Asterisk - The Open Source Telephony Project
18.5.0
|
Maintain a container of uniquely-named taskprocessor threads that can be shared across modules. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/module.h"
#include "asterisk/time.h"
#include "asterisk/astobj2.h"
#include "asterisk/cli.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/sem.h"
Go to the source code of this file.
Data Structures | |
struct | ast_taskprocessor |
A ast_taskprocessor structure is a singleton by name. More... | |
struct | ast_taskprocessor_listener |
A listener for taskprocessors. More... | |
struct | default_taskprocessor_listener_pvt |
struct | subsystem_alert |
struct | ast_taskprocessor::tps_queue |
Taskprocessor queue. More... | |
struct | tps_task |
tps_task structure is queued to a taskprocessor More... | |
struct | tps_taskprocessor_stats |
tps_taskprocessor_stats maintain statistics for a taskprocessor. More... | |
Macros | |
#define | FMT_FIELDS "%-70s %10lu %10lu %10lu %10lu %10lu\n" |
#define | FMT_FIELDS_SUBSYSTEM "%-32s %12u\n" |
#define | FMT_HEADERS "%-70s %10s %10s %10s %10s %10s\n" |
#define | FMT_HEADERS_SUBSYSTEM "%-32s %12s\n" |
#define | SEQ_STR_SIZE (1 + 8 + 1) /* Dash plus 8 hex digits plus null terminator */ |
#define | TPS_MAX_BUCKETS 1567 |
Functions | |
static struct ast_taskprocessor * | __allocate_taskprocessor (const char *name, struct ast_taskprocessor_listener *listener) |
static struct ast_taskprocessor * | __start_taskprocessor (struct ast_taskprocessor *p) |
unsigned int | ast_taskprocessor_alert_get (void) |
Get the current taskprocessor high water alert count. More... | |
int | ast_taskprocessor_alert_set_levels (struct ast_taskprocessor *tps, long low_water, long high_water) |
Set the high and low alert water marks of the given taskprocessor queue. More... | |
void | ast_taskprocessor_build_name (char *buf, unsigned int size, const char *format,...) |
Build a taskprocessor name with a sequence number on the end. More... | |
struct ast_taskprocessor * | ast_taskprocessor_create_with_listener (const char *name, struct ast_taskprocessor_listener *listener) |
Create a taskprocessor with a custom listener. More... | |
int | ast_taskprocessor_execute (struct ast_taskprocessor *tps) |
Pop a task off the taskprocessor and execute it. More... | |
struct ast_taskprocessor * | ast_taskprocessor_get (const char *name, enum ast_tps_options create) |
Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary. More... | |
unsigned int | ast_taskprocessor_get_subsystem_alert (const char *subsystem) |
Get the current taskprocessor high water alert count by sybsystem. More... | |
int | ast_taskprocessor_is_suspended (struct ast_taskprocessor *tps) |
Get the task processor suspend status. More... | |
int | ast_taskprocessor_is_task (struct ast_taskprocessor *tps) |
Am I the given taskprocessor's current task. More... | |
struct ast_taskprocessor_listener * | ast_taskprocessor_listener_alloc (const struct ast_taskprocessor_listener_callbacks *callbacks, void *user_data) |
Allocate a taskprocessor listener. More... | |
struct ast_taskprocessor * | ast_taskprocessor_listener_get_tps (const struct ast_taskprocessor_listener *listener) |
Get a reference to the listener's taskprocessor. More... | |
void * | ast_taskprocessor_listener_get_user_data (const struct ast_taskprocessor_listener *listener) |
Get the user data from the listener. More... | |
const char * | ast_taskprocessor_name (struct ast_taskprocessor *tps) |
Return the name of the taskprocessor singleton. More... | |
void | ast_taskprocessor_name_append (char *buf, unsigned int size, const char *name) |
Append the next sequence number to the given string, and copy into the buffer. More... | |
int | ast_taskprocessor_push (struct ast_taskprocessor *tps, int(*task_exe)(void *datap), void *datap) |
Push a task into the specified taskprocessor queue and signal the taskprocessor thread. More... | |
int | ast_taskprocessor_push_local (struct ast_taskprocessor *tps, int(*task_exe)(struct ast_taskprocessor_local *datap), void *datap) |
unsigned int | ast_taskprocessor_seq_num (void) |
Get the next sequence number to create a human friendly taskprocessor name. More... | |
void | ast_taskprocessor_set_local (struct ast_taskprocessor *tps, void *local_data) |
Sets the local data associated with a taskprocessor. More... | |
long | ast_taskprocessor_size (struct ast_taskprocessor *tps) |
Return the current size of the taskprocessor queue. More... | |
int | ast_taskprocessor_suspend (struct ast_taskprocessor *tps) |
Indicate the taskprocessor is suspended. More... | |
void * | ast_taskprocessor_unreference (struct ast_taskprocessor *tps) |
Unreference the specified taskprocessor and its reference count will decrement. More... | |
int | ast_taskprocessor_unsuspend (struct ast_taskprocessor *tps) |
Indicate the taskprocessor is unsuspended. More... | |
int | ast_tps_init (void) |
static | AST_VECTOR_RW (subsystem_alert_vector, struct subsystem_alert *) |
CLI taskprocessor ping <blah>operation requires a ping condition lock. More... | |
static char * | cli_subsystem_alert_report (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | cli_tps_ping (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | cli_tps_report (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | cli_tps_reset_stats (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | cli_tps_reset_stats_all (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | default_listener_die (void *data) |
static void * | default_listener_pvt_alloc (void) |
static void | default_listener_pvt_destroy (struct default_taskprocessor_listener_pvt *pvt) |
static void | default_listener_pvt_dtor (struct ast_taskprocessor_listener *listener) |
static void | default_listener_shutdown (struct ast_taskprocessor_listener *listener) |
static int | default_listener_start (struct ast_taskprocessor_listener *listener) |
static void | default_task_pushed (struct ast_taskprocessor_listener *listener, int was_empty) |
static void * | default_tps_processing_function (void *data) |
Function that processes tasks in the taskprocessor. More... | |
static void | listener_shutdown (struct ast_taskprocessor_listener *listener) |
static void | subsystem_alert_decrement (const char *subsystem) |
static void | subsystem_alert_increment (const char *subsystem) |
static int | subsystem_cmp (struct subsystem_alert *a, struct subsystem_alert *b) |
static void | subsystem_copy (struct subsystem_alert *alert, struct subsystem_alert_vector *vector) |
static int | subsystem_match (struct subsystem_alert *alert, const char *subsystem) |
static void | taskprocessor_listener_dtor (void *obj) |
static int | taskprocessor_push (struct ast_taskprocessor *tps, struct tps_task *t) |
static void | tps_alert_add (struct ast_taskprocessor *tps, int delta) |
static int | tps_cmp_cb (void *obj, void *arg, int flags) |
The astobj2 compare callback for taskprocessors. More... | |
static int | tps_hash_cb (const void *obj, const int flags) |
The astobj2 hash callback for taskprocessors. More... | |
static int | tps_ping_handler (void *datap) |
CLI taskprocessor ping <blah>handler function. More... | |
static int | tps_report_taskprocessor_list (int fd, const char *like) |
static void | tps_report_taskprocessor_list_helper (int fd, struct ast_taskprocessor *tps) |
static void | tps_reset_stats (struct ast_taskprocessor *tps) |
static void | tps_shutdown (void) |
static int | tps_sort_cb (const void *obj_left, const void *obj_right, int flags) |
static struct tps_task * | tps_task_alloc (int(*task_exe)(void *datap), void *datap) |
static struct tps_task * | tps_task_alloc_local (int(*task_exe)(struct ast_taskprocessor_local *local), void *datap) |
static void * | tps_task_free (struct tps_task *task) |
static void | tps_taskprocessor_dtor (void *tps) |
static struct tps_task * | tps_taskprocessor_pop (struct ast_taskprocessor *tps) |
static char * | tps_taskprocessor_tab_complete (struct ast_cli_args *a) |
Variables | |
static const struct ast_taskprocessor_listener_callbacks | default_listener_callbacks |
static struct ast_cli_entry | taskprocessor_clis [] |
static unsigned int | tps_alert_count |
static ast_rwlock_t | tps_alert_lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } |
Maintain a container of uniquely-named taskprocessor threads that can be shared across modules.
Definition in file taskprocessor.c.
#define FMT_FIELDS "%-70s %10lu %10lu %10lu %10lu %10lu\n" |
Definition at line 511 of file taskprocessor.c.
Referenced by tps_report_taskprocessor_list_helper().
#define FMT_FIELDS_SUBSYSTEM "%-32s %12u\n" |
Referenced by cli_subsystem_alert_report().
#define FMT_HEADERS "%-70s %10s %10s %10s %10s %10s\n" |
Definition at line 510 of file taskprocessor.c.
Referenced by cli_tps_report().
#define FMT_HEADERS_SUBSYSTEM "%-32s %12s\n" |
Referenced by cli_subsystem_alert_report().
#define SEQ_STR_SIZE (1 + 8 + 1) /* Dash plus 8 hex digits plus null terminator */ |
Definition at line 1283 of file taskprocessor.c.
Referenced by ast_taskprocessor_build_name(), and ast_taskprocessor_name_append().
#define TPS_MAX_BUCKETS 1567 |
Referenced by ast_tps_init().
|
static |
Definition at line 983 of file taskprocessor.c.
References ao2_alloc, ao2_link_flags, ao2_ref, ast_copy_string(), ast_log, AST_PTHREADT_NULL, AST_TASKPROCESSOR_HIGH_WATER_LEVEL, ast_taskprocessor::listener, listener(), LOG_ERROR, LOG_WARNING, name, ast_taskprocessor::name, NULL, OBJ_NOLOCK, ast_taskprocessor::subsystem, ast_taskprocessor::thread, ast_taskprocessor_listener::tps, ast_taskprocessor::tps_queue_high, ast_taskprocessor::tps_queue_low, and tps_taskprocessor_dtor().
Referenced by ast_taskprocessor_create_with_listener(), and ast_taskprocessor_get().
|
static |
Definition at line 1028 of file taskprocessor.c.
References ast_log, ast_taskprocessor_unreference(), ast_taskprocessor_listener::callbacks, ast_taskprocessor::listener, LOG_ERROR, ast_taskprocessor::name, NULL, and ast_taskprocessor_listener_callbacks::start.
Referenced by ast_taskprocessor_create_with_listener(), and ast_taskprocessor_get().
unsigned int ast_taskprocessor_alert_get | ( | void | ) |
Get the current taskprocessor high water alert count.
0 | if no taskprocessors are in high water alert. |
non-zero | if some task processors are in high water alert. |
Definition at line 819 of file taskprocessor.c.
References ast_rwlock_rdlock, ast_rwlock_unlock, tps_alert_count, and tps_alert_lock.
Referenced by AST_TEST_DEFINE(), and distributor().
int ast_taskprocessor_alert_set_levels | ( | struct ast_taskprocessor * | tps, |
long | low_water, | ||
long | high_water | ||
) |
Set the high and low alert water marks of the given taskprocessor queue.
tps | Taskprocessor to update queue water marks. |
low_water | New queue low water mark. (-1 to set as 90% of high_water) |
high_water | New queue high water mark. |
0 | on success. |
-1 | on error (water marks not changed). |
Definition at line 830 of file taskprocessor.c.
References ao2_lock, ao2_unlock, ast_taskprocessor::high_water_alert, tps_alert_add(), ast_taskprocessor::tps_queue_high, ast_taskprocessor::tps_queue_low, and ast_taskprocessor::tps_queue_size.
Referenced by actual_load_config(), ast_res_pjsip_init_options_handling(), ast_serializer_pool_set_alerts(), ast_sorcery_object_set_congestion_levels(), AST_TEST_DEFINE(), and stasis_subscription_set_congestion_limits().
void ast_taskprocessor_build_name | ( | char * | buf, |
unsigned int | size, | ||
const char * | format, | ||
... | |||
) |
Build a taskprocessor name with a sequence number on the end.
buf | Where to put the built taskprocessor name. |
size | How large is buf including null terminator. |
format | printf format to create the non-sequenced part of the name. |
Definition at line 1295 of file taskprocessor.c.
References ast_assert, ast_taskprocessor_seq_num(), NULL, and SEQ_STR_SIZE.
Referenced by alloc_playback_chan(), allocate_subscription_tree(), ast_sip_session_alloc(), create_websocket_serializer(), distributor_pool_setup(), internal_stasis_subscribe(), refer_progress_alloc(), sip_options_aor_alloc(), sip_outbound_publisher_alloc(), sip_outbound_registration_state_alloc(), and sorcery_object_type_alloc().
struct ast_taskprocessor* ast_taskprocessor_create_with_listener | ( | const char * | name, |
struct ast_taskprocessor_listener * | listener | ||
) |
Create a taskprocessor with a custom listener.
Note that when a taskprocessor is created in this way, it does not create any threads to execute the tasks. This job is left up to the listener. The listener's start() callback will be called during this function.
name | The name of the taskprocessor to create |
listener | The listener for operations on this taskprocessor |
NULL | Failure non-NULL success |
Definition at line 1083 of file taskprocessor.c.
References __allocate_taskprocessor(), __start_taskprocessor(), ao2_find, ao2_lock, ao2_unlock, ast_taskprocessor_unreference(), NULL, OBJ_KEY, and OBJ_NOLOCK.
Referenced by AST_TEST_DEFINE(), ast_threadpool_create(), and ast_threadpool_serializer_group().
int ast_taskprocessor_execute | ( | struct ast_taskprocessor * | tps | ) |
Pop a task off the taskprocessor and execute it.
tps | The taskprocessor from which to execute. |
0 | There is no further work to be done. |
1 | Tasks still remain in the taskprocessor queue. |
Definition at line 1212 of file taskprocessor.c.
References tps_taskprocessor_stats::_tasks_processed_count, ao2_lock, ao2_unlock, AST_PTHREADT_NULL, ast_taskprocessor_size(), tps_task::callback, ast_taskprocessor_listener::callbacks, ast_taskprocessor_local::data, tps_task::datap, ast_taskprocessor_listener_callbacks::emptied, tps_task::execute, tps_task::execute_local, ast_taskprocessor::executing, ast_taskprocessor::listener, ast_taskprocessor::local_data, ast_taskprocessor_local::local_data, tps_taskprocessor_stats::max_qsize, ast_taskprocessor::stats, ast_taskprocessor::thread, tps_task_free(), tps_taskprocessor_pop(), and tps_task::wants_local.
Referenced by AST_TEST_DEFINE(), default_tps_processing_function(), execute_tasks(), and threadpool_execute().
struct ast_taskprocessor* ast_taskprocessor_get | ( | const char * | name, |
enum ast_tps_options | create | ||
) |
Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary.
The default behavior of instantiating a taskprocessor if one does not already exist can be disabled by specifying the TPS_REF_IF_EXISTS ast_tps_options as the second argument to ast_taskprocessor_get().
name | The name of the taskprocessor |
create | Use 0 by default or specify TPS_REF_IF_EXISTS to return NULL if the taskprocessor does not already exist return A pointer to a reference counted taskprocessor under normal conditions, or NULL if the TPS_REF_IF_EXISTS reference type is specified and the taskprocessor does not exist |
Definition at line 1044 of file taskprocessor.c.
References __allocate_taskprocessor(), __start_taskprocessor(), ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_log, ast_strlen_zero, ast_taskprocessor_listener_alloc(), default_listener_pvt_alloc(), default_listener_pvt_destroy(), listener(), LOG_ERROR, NULL, OBJ_KEY, OBJ_NOLOCK, and TPS_REF_IF_EXISTS.
Referenced by alloc_playback_chan(), ast_dns_system_resolver_init(), ast_msg_init(), AST_TEST_DEFINE(), cli_tps_ping(), cli_tps_reset_stats(), find_request_serializer(), internal_stasis_subscribe(), load_module(), load_objects(), and threadpool_alloc().
unsigned int ast_taskprocessor_get_subsystem_alert | ( | const char * | subsystem | ) |
Get the current taskprocessor high water alert count by sybsystem.
subsystem | The subsystem name |
0 | if no taskprocessors are in high water alert. |
non-zero | if some task processors are in high water alert. |
Definition at line 637 of file taskprocessor.c.
References subsystem_alert::alert_count, AST_VECTOR_GET, AST_VECTOR_GET_INDEX, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, and subsystem_match().
Referenced by AST_TEST_DEFINE(), and distributor().
int ast_taskprocessor_is_suspended | ( | struct ast_taskprocessor * | tps | ) |
Get the task processor suspend status.
tps | Task processor. |
non-zero | if the task processor is suspended |
Definition at line 1207 of file taskprocessor.c.
References ast_taskprocessor::suspended.
Referenced by ast_sip_session_suspend().
int ast_taskprocessor_is_task | ( | struct ast_taskprocessor * | tps | ) |
Am I the given taskprocessor's current task.
tps | Taskprocessor to check. |
non-zero | if current thread is the taskprocessor thread. |
Definition at line 1266 of file taskprocessor.c.
References ao2_lock, ao2_unlock, and ast_taskprocessor::thread.
Referenced by ast_sip_push_task_wait_serializer(), ast_sip_session_suspend(), and handle_new_invite_request().
struct ast_taskprocessor_listener* ast_taskprocessor_listener_alloc | ( | const struct ast_taskprocessor_listener_callbacks * | callbacks, |
void * | user_data | ||
) |
Allocate a taskprocessor listener.
This will result in the listener being allocated with the specified callbacks.
callbacks | The callbacks to assign to the listener |
user_data | The user data for the listener |
NULL | Failure |
non-NULL | The newly allocated taskprocessor listener |
Definition at line 930 of file taskprocessor.c.
References ao2_alloc, ast_taskprocessor_listener::callbacks, listener(), NULL, taskprocessor_listener_dtor(), and ast_taskprocessor_listener::user_data.
Referenced by ast_taskprocessor_get(), AST_TEST_DEFINE(), ast_threadpool_create(), and ast_threadpool_serializer_group().
struct ast_taskprocessor* ast_taskprocessor_listener_get_tps | ( | const struct ast_taskprocessor_listener * | listener | ) |
Get a reference to the listener's taskprocessor.
This will return the taskprocessor with its reference count increased. Release the reference to this object by using ast_taskprocessor_unreference()
listener | The listener that has the taskprocessor |
Definition at line 944 of file taskprocessor.c.
References ao2_ref, and ast_taskprocessor_listener::tps.
Referenced by serializer_task_pushed().
void* ast_taskprocessor_listener_get_user_data | ( | const struct ast_taskprocessor_listener * | listener | ) |
Get the user data from the listener.
listener | The taskprocessor listener |
Definition at line 950 of file taskprocessor.c.
References ast_taskprocessor_listener::user_data.
Referenced by serializer_shutdown(), serializer_task_pushed(), test_emptied(), test_shutdown(), test_task_pushed(), threadpool_tps_emptied(), threadpool_tps_shutdown(), and threadpool_tps_task_pushed().
const char* ast_taskprocessor_name | ( | struct ast_taskprocessor * | tps | ) |
Return the name of the taskprocessor singleton.
Definition at line 906 of file taskprocessor.c.
References ast_log, LOG_ERROR, ast_taskprocessor::name, and NULL.
Referenced by ast_serializer_pool_set_alerts(), ast_sip_get_distributor_serializer(), distributor(), grow(), record_serializer(), shrink(), sip_options_apply_aor_configuration(), and sip_options_contact_add_task().
void ast_taskprocessor_name_append | ( | char * | buf, |
unsigned int | size, | ||
const char * | name | ||
) |
Append the next sequence number to the given string, and copy into the buffer.
buf | Where to copy the appended taskprocessor name. |
size | How large is buf including null terminator. |
name | A name to append the sequence number to. |
Definition at line 1285 of file taskprocessor.c.
References ast_assert, ast_taskprocessor_seq_num(), NULL, and SEQ_STR_SIZE.
Referenced by ast_serializer_pool_create().
int ast_taskprocessor_push | ( | struct ast_taskprocessor * | tps, |
int(*)(void *datap) | task_exe, | ||
void * | datap | ||
) |
Push a task into the specified taskprocessor queue and signal the taskprocessor thread.
tps | The taskprocessor structure |
task_exe | The task handling function to push into the taskprocessor queue |
datap | The data to be used by the task handling function |
0 | success |
-1 | failure |
Definition at line 1175 of file taskprocessor.c.
References taskprocessor_push(), and tps_task_alloc().
Referenced by ast_cc_agent_status_response(), ast_cc_monitor_failed(), ast_cc_monitor_party_b_free(), ast_cc_monitor_status_request(), ast_cc_monitor_stop_ringing(), ast_msg_queue(), ast_sip_push_task(), ast_sorcery_create(), ast_sorcery_delete(), ast_sorcery_update(), AST_TEST_DEFINE(), ast_threadpool_push(), ast_threadpool_set_size(), async_delete_name_rec(), async_play_sound_helper(), cc_request_state_change(), cli_tps_ping(), default_listener_shutdown(), destroy_conference_bridge(), dns_system_resolver_resolve(), generic_monitor_devstate_cb(), handle_cc_status(), hepv3_send_packet(), iax2_transmit(), mwi_handle_subscribe(), mwi_handle_unsubscribe(), play_sound_helper(), sorcery_object_load(), stasis_unsubscribe(), threadpool_active_thread_idle(), threadpool_idle_thread_dead(), threadpool_tps_emptied(), threadpool_tps_task_pushed(), and threadpool_zombie_thread_dead().
int ast_taskprocessor_push_local | ( | struct ast_taskprocessor * | tps, |
int(*)(struct ast_taskprocessor_local *datap) | task_exe, | ||
void * | datap | ||
) |
Definition at line 1180 of file taskprocessor.c.
References taskprocessor_push(), and tps_task_alloc_local().
unsigned int ast_taskprocessor_seq_num | ( | void | ) |
Get the next sequence number to create a human friendly taskprocessor name.
Definition at line 1276 of file taskprocessor.c.
References ast_atomic_fetchadd_int().
Referenced by ast_taskprocessor_build_name(), and ast_taskprocessor_name_append().
void ast_taskprocessor_set_local | ( | struct ast_taskprocessor * | tps, |
void * | local_data | ||
) |
Sets the local data associated with a taskprocessor.
See ast_taskprocessor_push_local().
tps | Task processor. |
local_data | Local data to associate with tps. |
Definition at line 1101 of file taskprocessor.c.
References ast_taskprocessor::local_data, lock, and SCOPED_AO2LOCK.
Referenced by AST_TEST_DEFINE(), and internal_stasis_subscribe().
long ast_taskprocessor_size | ( | struct ast_taskprocessor * | tps | ) |
Return the current size of the taskprocessor queue.
Definition at line 900 of file taskprocessor.c.
References ast_taskprocessor::tps_queue_size.
Referenced by ast_serializer_pool_get(), ast_taskprocessor_execute(), AST_TEST_DEFINE(), and ast_threadpool_queue_size().
int ast_taskprocessor_suspend | ( | struct ast_taskprocessor * | tps | ) |
Indicate the taskprocessor is suspended.
tps | Task processor. |
0 | success |
-1 | failure |
Definition at line 1185 of file taskprocessor.c.
References ao2_lock, ao2_unlock, and ast_taskprocessor::suspended.
Referenced by ast_sip_session_suspend(), and AST_TEST_DEFINE().
void* ast_taskprocessor_unreference | ( | struct ast_taskprocessor * | tps | ) |
Unreference the specified taskprocessor and its reference count will decrement.
Taskprocessors use astobj2 and will unlink from the taskprocessor singleton container and destroy themself when the taskprocessor reference count reaches zero.
tps | taskprocessor to unreference |
Definition at line 1109 of file taskprocessor.c.
References ao2_lock, ao2_ref, ao2_unlink_flags, ao2_unlock, ast_taskprocessor::listener, listener_shutdown(), NULL, and OBJ_NOLOCK.
Referenced by __start_taskprocessor(), __unload_module(), ast_msg_shutdown(), ast_res_pjsip_cleanup_options_handling(), ast_serializer_pool_destroy(), ast_taskprocessor_create_with_listener(), AST_TEST_DEFINE(), ast_threadpool_shutdown(), cli_tps_ping(), cli_tps_reset_stats(), cli_tps_reset_stats_all(), destroy_conference_bridge(), distributor(), distributor_pool_shutdown(), dns_system_resolver_destroy(), execute_tasks(), exten_state_subscription_destructor(), refer_progress_destroy(), scheduler(), schtd_dtor(), serializer_task_pushed(), session_destructor(), sip_options_aor_dtor(), sip_outbound_publisher_destroy(), sip_outbound_registration_client_state_destroy(), sip_resolve_destroy(), sorcery_object_type_destructor(), subscription_dtor(), subscription_persistence_recreate(), subscription_tree_destructor(), tps_report_taskprocessor_list(), tps_shutdown_thread(), tps_taskprocessor_tab_complete(), unload_module(), and websocket_cb().
int ast_taskprocessor_unsuspend | ( | struct ast_taskprocessor * | tps | ) |
Indicate the taskprocessor is unsuspended.
tps | Task processor. |
0 | success |
-1 | failure |
Definition at line 1196 of file taskprocessor.c.
References ao2_lock, ao2_unlock, and ast_taskprocessor::suspended.
Referenced by ast_sip_session_unsuspend(), and AST_TEST_DEFINE().
int ast_tps_init | ( | void | ) |
Provided by taskprocessor.c
Definition at line 301 of file taskprocessor.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_cond_init, ast_log, ast_register_cleanup(), AST_VECTOR_RW_INIT, LOG_ERROR, NULL, tps_cmp_cb(), tps_hash_cb(), TPS_MAX_BUCKETS, and tps_shutdown().
Referenced by asterisk_daemon().
|
static |
CLI taskprocessor ping <blah>operation requires a ping condition lock.
Definition at line 127 of file taskprocessor.c.
|
static |
Definition at line 729 of file taskprocessor.c.
References subsystem_alert::alert_count, ast_cli_args::argc, ast_cli_entry::args, ast_cli(), ast_free, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FMT_FIELDS_SUBSYSTEM, FMT_HEADERS_SUBSYSTEM, NULL, subsystem_alert::subsystem, subsystem_copy(), and ast_cli_entry::usage.
|
static |
Definition at line 411 of file taskprocessor.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_cond_timedwait, ast_mutex_lock, ast_mutex_unlock, ast_samp2tv(), ast_taskprocessor_get(), ast_taskprocessor_push(), ast_taskprocessor_unreference(), ast_tvadd(), ast_tvnow(), ast_tvsub(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, name, NULL, ast_cli_args::pos, tps_ping_handler(), TPS_REF_IF_EXISTS, tps_taskprocessor_tab_complete(), and ast_cli_entry::usage.
|
static |
Definition at line 576 of file taskprocessor.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FMT_HEADERS, NULL, ast_cli_args::pos, tps_report_taskprocessor_list(), tps_taskprocessor_tab_complete(), and ast_cli_entry::usage.
|
static |
Definition at line 1329 of file taskprocessor.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_taskprocessor_get(), ast_taskprocessor_unreference(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, name, NULL, TPS_REF_IF_EXISTS, tps_reset_stats(), tps_taskprocessor_tab_complete(), and ast_cli_entry::usage.
|
static |
Definition at line 1363 of file taskprocessor.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_cli_args::argc, ast_cli_entry::args, ast_cli(), ast_taskprocessor_unreference(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, tps_reset_stats(), and ast_cli_entry::usage.
|
static |
Definition at line 243 of file taskprocessor.c.
References default_taskprocessor_listener_pvt::dead.
Referenced by default_listener_shutdown().
|
static |
Definition at line 955 of file taskprocessor.c.
References ast_calloc, ast_free, ast_log, AST_PTHREADT_NULL, ast_sem_init(), errno, LOG_ERROR, NULL, default_taskprocessor_listener_pvt::poll_thread, and default_taskprocessor_listener_pvt::sem.
Referenced by ast_taskprocessor_get().
|
static |
Definition at line 173 of file taskprocessor.c.
References ast_assert, ast_free, ast_sem_destroy(), default_taskprocessor_listener_pvt::dead, and default_taskprocessor_listener_pvt::sem.
Referenced by ast_taskprocessor_get(), and default_listener_pvt_dtor().
|
static |
Definition at line 180 of file taskprocessor.c.
References default_listener_pvt_destroy(), NULL, and ast_taskprocessor_listener::user_data.
|
static |
Definition at line 250 of file taskprocessor.c.
References ao2_t_ref, ast_assert, ast_log, AST_PTHREADT_NULL, ast_taskprocessor_push(), default_listener_die(), errno, LOG_ERROR, NULL, default_taskprocessor_listener_pvt::poll_thread, ast_taskprocessor_listener::tps, and ast_taskprocessor_listener::user_data.
|
static |
Definition at line 222 of file taskprocessor.c.
References ast_pthread_create, default_tps_processing_function(), NULL, default_taskprocessor_listener_pvt::poll_thread, and ast_taskprocessor_listener::user_data.
|
static |
Definition at line 233 of file taskprocessor.c.
References ast_log, ast_sem_post(), errno, LOG_ERROR, default_taskprocessor_listener_pvt::sem, and ast_taskprocessor_listener::user_data.
|
static |
Function that processes tasks in the taskprocessor.
Definition at line 193 of file taskprocessor.c.
References ao2_t_ref, ast_assert, ast_log, ast_sem_getvalue(), ast_sem_wait(), ast_taskprocessor_execute(), default_taskprocessor_listener_pvt::dead, errno, listener(), LOG_ERROR, NULL, default_taskprocessor_listener_pvt::sem, ast_taskprocessor_listener::tps, and ast_taskprocessor_listener::user_data.
Referenced by default_listener_start().
|
static |
Definition at line 915 of file taskprocessor.c.
References ao2_ref, ast_taskprocessor_listener::callbacks, ast_taskprocessor_listener_callbacks::shutdown, and ast_taskprocessor_listener::tps.
Referenced by ast_taskprocessor_unreference().
|
static |
Definition at line 686 of file taskprocessor.c.
References subsystem_alert::alert_count, ast_free, ast_log, ast_strlen_zero, AST_VECTOR_GET, AST_VECTOR_GET_INDEX, AST_VECTOR_REMOVE, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, LOG_ERROR, and subsystem_match().
Referenced by tps_alert_add().
|
static |
Definition at line 654 of file taskprocessor.c.
References subsystem_alert::alert_count, ast_free, ast_malloc, ast_strlen_zero, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_GET_INDEX, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, subsystem_alert::subsystem, and subsystem_match().
Referenced by tps_alert_add().
|
static |
Definition at line 632 of file taskprocessor.c.
References subsystem_alert::subsystem.
Referenced by subsystem_copy().
|
static |
Definition at line 714 of file taskprocessor.c.
References subsystem_alert::alert_count, ast_free, ast_malloc, AST_VECTOR_ADD_SORTED, subsystem_alert::subsystem, and subsystem_cmp().
Referenced by cli_subsystem_alert_report().
|
static |
Definition at line 627 of file taskprocessor.c.
References subsystem_alert::subsystem.
Referenced by ast_taskprocessor_get_subsystem_alert(), subsystem_alert_decrement(), and subsystem_alert_increment().
|
static |
Definition at line 921 of file taskprocessor.c.
References ast_taskprocessor_listener::callbacks, ast_taskprocessor_listener_callbacks::dtor, and listener().
Referenced by ast_taskprocessor_listener_alloc().
|
static |
Definition at line 1139 of file taskprocessor.c.
References ao2_lock, ao2_unlock, AST_LIST_INSERT_TAIL, ast_log, ast_taskprocessor_listener::callbacks, ast_taskprocessor::executing, ast_taskprocessor::high_water_alert, ast_taskprocessor::high_water_warned, tps_task::list, ast_taskprocessor::listener, LOG_ERROR, LOG_WARNING, ast_taskprocessor::name, ast_taskprocessor_listener_callbacks::task_pushed, tps_alert_add(), ast_taskprocessor::tps_queue, ast_taskprocessor::tps_queue_high, and ast_taskprocessor::tps_queue_size.
Referenced by ast_taskprocessor_push(), and ast_taskprocessor_push_local().
|
static |
Definition at line 794 of file taskprocessor.c.
References ast_log, ast_rwlock_unlock, ast_rwlock_wrlock, DEBUG_ATLEAST, LOG_DEBUG, ast_taskprocessor::name, ast_taskprocessor::subsystem, subsystem_alert_decrement(), subsystem_alert_increment(), tps_alert_count, and tps_alert_lock.
Referenced by ast_taskprocessor_alert_set_levels(), taskprocessor_push(), tps_taskprocessor_dtor(), and tps_taskprocessor_pop().
|
static |
The astobj2 compare callback for taskprocessors.
Definition at line 619 of file taskprocessor.c.
References CMP_MATCH, CMP_STOP, ast_taskprocessor::name, and OBJ_KEY.
Referenced by ast_tps_init().
|
static |
The astobj2 hash callback for taskprocessors.
Definition at line 610 of file taskprocessor.c.
References ast_str_case_hash(), name, ast_taskprocessor::name, and OBJ_KEY.
Referenced by ast_tps_init().
|
static |
CLI taskprocessor ping <blah>handler function.
Definition at line 402 of file taskprocessor.c.
References ast_cond_signal, ast_mutex_lock, and ast_mutex_unlock.
Referenced by cli_tps_ping().
|
static |
Definition at line 539 of file taskprocessor.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_rbtree, ao2_container_dup(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_ref, ast_debug, ast_taskprocessor_unreference(), ast_taskprocessor::name, NULL, tps_report_taskprocessor_list_helper(), and tps_sort_cb().
Referenced by cli_tps_report().
|
static |
Definition at line 521 of file taskprocessor.c.
References tps_taskprocessor_stats::_tasks_processed_count, ast_cli(), FMT_FIELDS, tps_taskprocessor_stats::max_qsize, ast_taskprocessor::name, ast_taskprocessor::stats, ast_taskprocessor::tps_queue_high, ast_taskprocessor::tps_queue_low, and ast_taskprocessor::tps_queue_size.
Referenced by tps_report_taskprocessor_list().
|
static |
Definition at line 1321 of file taskprocessor.c.
References tps_taskprocessor_stats::_tasks_processed_count, ao2_lock, ao2_unlock, tps_taskprocessor_stats::max_qsize, and ast_taskprocessor::stats.
Referenced by cli_tps_reset_stats(), and cli_tps_reset_stats_all().
|
static |
Definition at line 291 of file taskprocessor.c.
References ao2_t_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_free, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_RW_FREE, and NULL.
Referenced by ast_tps_init().
|
static |
Definition at line 488 of file taskprocessor.c.
References ast_taskprocessor::name, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by tps_report_taskprocessor_list().
|
static |
Definition at line 326 of file taskprocessor.c.
References ast_calloc, ast_log, tps_task::callback, tps_task::datap, tps_task::execute, LOG_ERROR, and NULL.
Referenced by ast_taskprocessor_push().
|
static |
Definition at line 346 of file taskprocessor.c.
References ast_calloc, ast_log, tps_task::callback, tps_task::datap, tps_task::execute_local, LOG_ERROR, NULL, and tps_task::wants_local.
Referenced by ast_taskprocessor_push_local().
|
static |
Definition at line 368 of file taskprocessor.c.
References ast_free, and NULL.
Referenced by ast_taskprocessor_execute(), and tps_taskprocessor_dtor().
|
static |
Definition at line 866 of file taskprocessor.c.
References ao2_cleanup, AST_LIST_REMOVE_HEAD, ast_taskprocessor::high_water_alert, tps_task::list, ast_taskprocessor::listener, NULL, task(), tps_alert_add(), ast_taskprocessor::tps_queue, ast_taskprocessor::tps_queue_size, and tps_task_free().
Referenced by __allocate_taskprocessor().
|
static |
Definition at line 886 of file taskprocessor.c.
References AST_LIST_REMOVE_HEAD, ast_taskprocessor::high_water_alert, tps_task::list, task(), tps_alert_add(), ast_taskprocessor::tps_queue, ast_taskprocessor::tps_queue_low, and ast_taskprocessor::tps_queue_size.
Referenced by ast_taskprocessor_execute().
|
static |
Definition at line 379 of file taskprocessor.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_cli_completion_add(), ast_strdup, ast_taskprocessor_unreference(), ast_taskprocessor::name, NULL, and ast_cli_args::word.
Referenced by cli_tps_ping(), cli_tps_report(), and cli_tps_reset_stats().
|
static |
Definition at line 280 of file taskprocessor.c.
|
static |
Definition at line 159 of file taskprocessor.c.
|
static |
Count of the number of taskprocessors in high water alert.
Definition at line 779 of file taskprocessor.c.
Referenced by ast_taskprocessor_alert_get(), and tps_alert_add().
|
static |
Access protection for tps_alert_count
Definition at line 782 of file taskprocessor.c.
Referenced by ast_taskprocessor_alert_get(), and tps_alert_add().