Asterisk - The Open Source Telephony Project
18.5.0
|
An opaque threadpool structure. More...
Data Fields | |
struct ao2_container * | active_threads |
The container of active threads. Active threads are those that are currently running tasks. More... | |
struct ast_taskprocessor * | control_tps |
The control taskprocessor. More... | |
struct ao2_container * | idle_threads |
The container of idle threads. Idle threads are those that are currenly waiting to run tasks. More... | |
struct ast_threadpool_listener * | listener |
struct ast_threadpool_options | options |
int | shutting_down |
struct ast_taskprocessor * | tps |
The main taskprocessor. More... | |
struct ao2_container * | zombie_threads |
The container of zombie threads. Zombie threads may be running tasks, but they are scheduled to die soon. More... | |
An opaque threadpool structure.
A threadpool is a collection of threads that execute tasks from a common queue.
Definition at line 36 of file threadpool.c.
struct ao2_container* active_threads |
The container of active threads. Active threads are those that are currently running tasks.
Definition at line 43 of file threadpool.c.
Referenced by activate_thread(), grow(), queued_active_thread_idle(), queued_set_size(), queued_task_pushed(), shrink(), threadpool_send_state_changed(), and threadpool_tps_shutdown().
struct ast_taskprocessor* control_tps |
The control taskprocessor.
This is a standard taskprocessor that uses the default taskprocessor listener. In other words, all tasks queued to this taskprocessor have a single thread that executes the tasks.
All tasks that modify the state of the threadpool and all tasks that call out to threadpool listeners are pushed to this taskprocessor.
For instance, when the threadpool changes sizes, a task is put into this taskprocessor to do so. When it comes time to tell the threadpool listener that worker threads have changed state, the task is placed in this taskprocessor.
This is done for three main reasons 1) It ensures that listeners are given an accurate portrayal of the threadpool's current state. In other words, when a listener gets told a count of active, idle and zombie threads, it does not need to worry that internal state of the threadpool might be different from what it has been told. 2) It minimizes the locking required in both the threadpool and in threadpool listener's callbacks. 3) It ensures that listener callbacks are called in the same order that the threadpool had its state change.
Definition at line 96 of file threadpool.c.
Referenced by ast_threadpool_set_size(), ast_threadpool_shutdown(), threadpool_active_thread_idle(), threadpool_idle_thread_dead(), threadpool_tps_emptied(), threadpool_tps_task_pushed(), and threadpool_zombie_thread_dead().
struct ao2_container* idle_threads |
The container of idle threads. Idle threads are those that are currenly waiting to run tasks.
Definition at line 48 of file threadpool.c.
Referenced by grow(), queued_active_thread_idle(), queued_idle_thread_dead(), queued_set_size(), queued_task_pushed(), shrink(), threadpool_send_state_changed(), and threadpool_tps_shutdown().
struct ast_threadpool_listener* listener |
Threadpool listener
Definition at line 38 of file threadpool.c.
Referenced by ast_threadpool_create(), ast_threadpool_listener_alloc(), ast_threadpool_serializer_group(), queued_emptied(), queued_task_pushed(), threadpool_destructor(), threadpool_send_state_changed(), threadpool_tps_emptied(), and threadpool_tps_shutdown().
struct ast_threadpool_options options |
Threadpool-specific options
Definition at line 100 of file threadpool.c.
Referenced by grow(), queued_task_pushed(), threadpool_alloc(), and worker_thread_alloc().
int shutting_down |
True if the threadpool is in the process of shutting down
Definition at line 98 of file threadpool.c.
Referenced by ast_threadpool_push(), ast_threadpool_set_size(), ast_threadpool_shutdown(), threadpool_active_thread_idle(), threadpool_execute(), threadpool_idle_thread_dead(), threadpool_tps_emptied(), threadpool_tps_task_pushed(), and threadpool_zombie_thread_dead().
struct ast_taskprocessor* tps |
The main taskprocessor.
Tasks that are queued in this taskprocessor are doled out to the worker threads. Worker threads that execute tasks from the threadpool are executing tasks in this taskprocessor.
The threadpool itself is actually the private data for this taskprocessor's listener. This way, as taskprocessor changes occur, the threadpool can alert its listeners appropriately.
Definition at line 67 of file threadpool.c.
Referenced by ast_threadpool_create(), ast_threadpool_push(), ast_threadpool_queue_size(), ast_threadpool_serializer_group(), ast_threadpool_shutdown(), execute_tasks(), grow(), serializer_task_pushed(), shrink(), and threadpool_execute().
struct ao2_container* zombie_threads |
The container of zombie threads. Zombie threads may be running tasks, but they are scheduled to die soon.
Definition at line 53 of file threadpool.c.
Referenced by queued_zombie_thread_dead(), threadpool_tps_shutdown(), and zombify_threads().