54 ast_debug(3,
"Waiting on serializers before destroying pool '%s'\n", pool->name);
62 "'%d' dependencies still processing.\n", pool->name, remaining);
85 pool =
ast_malloc(
sizeof(*pool) + strlen(name) + 1);
90 strcpy(pool->name, name);
97 for (idx = 0; idx < size; ++idx) {
166 tps_queue_high = high;
167 if (tps_queue_high <= 0) {
169 "trigger level '%ld'\n", pool->name, tps_queue_high);
174 if (tps_queue_low < -1 || tps_queue_high < tps_queue_low) {
176 "level '%ld'\n", pool->name, tps_queue_low);
#define AST_VECTOR_RW_INIT(vec, size)
Initialize a vector with a read/write lock.
Asterisk main include file. File version handling, generic pbx 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.
long ast_taskprocessor_size(struct ast_taskprocessor *tps)
Return the current size of the taskprocessor queue.
#define AST_VECTOR_RW(name, type)
Define a vector structure with a read/write lock.
#define AST_VECTOR_RW_UNLOCK(vec)
Unlock vector.
#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL
struct ast_serializer_shutdown_group * ast_serializer_shutdown_group_alloc(void)
Create a serializer group shutdown control object.
static pj_pool_t * pool
Global memory pool for configuration and timers.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
struct ast_taskprocessor * ast_threadpool_serializer_group(const char *name, struct ast_threadpool *pool, struct ast_serializer_shutdown_group *shutdown_group)
Serialized execution of tasks within a ast_threadpool.
#define AST_VECTOR_RW_RDLOCK(vec)
Obtain read lock on vector.
const char * ast_serializer_pool_name(const struct ast_serializer_pool *pool)
Retrieve the base name of the serializer pool.
const char * ast_taskprocessor_name(struct ast_taskprocessor *tps)
Return the name of the taskprocessor singleton.
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.
int ast_serializer_pool_destroy(struct ast_serializer_pool *pool)
Destroy the serializer pool.
long tps_queue_high
Taskprocessor high water alert trigger level.
#define AST_TASKPROCESSOR_MAX_NAME
Suggested maximum taskprocessor name length (less null terminator).
int ast_serializer_shutdown_group_join(struct ast_serializer_shutdown_group *shutdown_group, int timeout)
Wait for the serializers in the group to shutdown with timeout.
#define ast_debug(level,...)
Log a DEBUG message.
long tps_queue_low
Taskprocessor low water clear alert level.
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.
#define AST_VECTOR_RW_FREE(vec)
Deallocates this locked vector.
struct ast_taskprocessor * ast_serializer_pool_get(struct ast_serializer_pool *pool)
Retrieve a serializer from the pool.
#define ao2_ref(o, delta)
#define ast_malloc(len)
A wrapper for malloc()
static struct ast_threadpool * threadpool
Thread pool for observers.
struct ast_serializer_shutdown_group * shutdown_group
#define AST_VECTOR_RW_WRLOCK(vec)
Obtain write lock on vector.
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
Vector container support.
An API for managing task processing threads that can be shared across modules.
int shutdown_group_timeout
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
A ast_taskprocessor structure is a singleton by name.
An opaque threadpool structure.
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
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.