|
Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"#include "asterisk/astobj2.h"#include "asterisk/serializer.h"#include "asterisk/taskprocessor.h"#include "asterisk/threadpool.h"#include "asterisk/utils.h"#include "asterisk/vector.h"
Go to the source code of this file.
Data Structures | |
| struct | ast_serializer_pool |
Functions | |
| struct ast_serializer_pool * | ast_serializer_pool_create (const char *name, unsigned int size, struct ast_threadpool *threadpool, int timeout) |
| Create a serializer pool. More... | |
| int | ast_serializer_pool_destroy (struct ast_serializer_pool *pool) |
| Destroy the serializer pool. More... | |
| struct ast_taskprocessor * | ast_serializer_pool_get (struct ast_serializer_pool *pool) |
| Retrieve a serializer from the pool. More... | |
| const char * | ast_serializer_pool_name (const struct ast_serializer_pool *pool) |
| Retrieve the base name of the serializer pool. More... | |
| int | ast_serializer_pool_set_alerts (struct ast_serializer_pool *pool, long high, long low) |
| Set taskprocessor alert levels for the serializers in the pool. More... | |
| struct ast_serializer_pool* ast_serializer_pool_create | ( | const char * | name, |
| unsigned int | size, | ||
| struct ast_threadpool * | threadpool, | ||
| int | timeout | ||
| ) |
Create a serializer pool.
Create a serializer pool with an optional shutdown group. If a timeout greater than -1 is specified then a shutdown group is enabled on the pool.
| name | The base name for the pool, and used when building taskprocessor(s) |
| size | The size of the pool |
| threadpool | The backing threadpool to use |
| timeout | The timeout used if using a shutdown group (-1 = disabled) |
| A | newly allocated serializer pool object, or NULL on error |
Definition at line 76 of file serializer.c.
References ast_assert, ast_log, ast_malloc, ast_serializer_pool_destroy(), ast_serializer_shutdown_group_alloc(), AST_TASKPROCESSOR_MAX_NAME, ast_taskprocessor_name_append(), ast_threadpool_serializer_group(), AST_VECTOR_APPEND, AST_VECTOR_RW_INIT, LOG_ERROR, NULL, pool, ast_serializer_pool::shutdown_group, ast_serializer_pool::shutdown_group_timeout, and timeout.
Referenced by AST_TEST_DEFINE(), and load_module().
| int ast_serializer_pool_destroy | ( | struct ast_serializer_pool * | pool | ) |
Destroy the serializer pool.
Attempt to destroy the serializer pool. If a shutdown group has been enabled, and times out waiting for threads to complete, then this function will return the number of remaining threads, and the pool will not be destroyed.
| pool | The pool to destroy |
Definition at line 39 of file serializer.c.
References ao2_ref, ast_debug, ast_free, ast_log, ast_serializer_shutdown_group_join(), ast_taskprocessor_unreference(), AST_VECTOR_RESET, AST_VECTOR_RW_FREE, AST_VECTOR_RW_UNLOCK, AST_VECTOR_RW_WRLOCK, LOG_WARNING, NULL, ast_serializer_pool::shutdown_group, and ast_serializer_pool::shutdown_group_timeout.
Referenced by ast_serializer_pool_create(), AST_TEST_DEFINE(), load_module(), and unload_module().
| struct ast_taskprocessor* ast_serializer_pool_get | ( | struct ast_serializer_pool * | pool | ) |
Retrieve a serializer from the pool.
| pool | The pool object |
| A | serializer/taskprocessor |
Definition at line 127 of file serializer.c.
References ast_taskprocessor_size(), AST_VECTOR_GET, AST_VECTOR_RW_RDLOCK, AST_VECTOR_RW_UNLOCK, AST_VECTOR_SIZE, and NULL.
Referenced by ast_sip_push_task(), ast_sip_push_task_wait_serializer(), AST_TEST_DEFINE(), load_module(), mwi_startup_event_cb(), mwi_stasis_cb(), send_contact_notify(), and send_notify().
| const char* ast_serializer_pool_name | ( | const struct ast_serializer_pool * | pool | ) |
Retrieve the base name of the serializer pool.
| pool | The pool object |
| The | base name given to the pool |
Definition at line 122 of file serializer.c.
Referenced by AST_TEST_DEFINE().
| int ast_serializer_pool_set_alerts | ( | struct ast_serializer_pool * | pool, |
| long | high, | ||
| long | low | ||
| ) |
Set taskprocessor alert levels for the serializers in the pool.
| pool | The pool to destroy |
| 0 | on success, or -1 on error. |
Definition at line 156 of file serializer.c.
References ast_log, AST_LOG_WARNING, ast_taskprocessor_alert_set_levels(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, ast_taskprocessor_name(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_taskprocessor::tps_queue_high, and ast_taskprocessor::tps_queue_low.
Referenced by AST_TEST_DEFINE(), and global_loaded().
1.8.13