static void thread_worker_pair_destructor(void *obj)
{
struct thread_worker_pair *pair = obj;
- ao2_ref(pair->pool, -1);
ao2_ref(pair->worker, -1);
}
if (!pair) {
return NULL;
}
- ao2_ref(pool, +1);
pair->pool = pool;
ao2_ref(worker, +1);
pair->worker = worker;
int was_empty;
};
-/*!
- * \brief Destructor for task_pushed_data
- */
-static void task_pushed_data_destroy(void *obj)
-{
- struct task_pushed_data *tpd = obj;
- ao2_ref(tpd->pool, -1);
-}
-
/*!
* \brief Allocate and initialize a task_pushed_data
* \param pool The threadpool to set in the task_pushed_data
static struct task_pushed_data *task_pushed_data_alloc(struct ast_threadpool *pool,
int was_empty)
{
- struct task_pushed_data *tpd = ao2_alloc(sizeof(*tpd),
- task_pushed_data_destroy);
+ struct task_pushed_data *tpd = ao2_alloc(sizeof(*tpd), NULL);
if (!tpd) {
return NULL;
}
- ao2_ref(pool, +1);
tpd->pool = pool;
tpd->was_empty = was_empty;
return tpd;
struct ast_threadpool *pool = data;
pool->listener->callbacks->emptied(pool->listener);
- ao2_ref(pool, -1);
return 0;
}
{
struct ast_threadpool *pool = listener->private_data;
- ao2_ref(pool, +1);
ast_taskprocessor_push(pool->control_tps, handle_emptied, pool);
}
unsigned int size;
};
-/*!
- * \brief Destructor for set_size_data
- * \param obj The set_size_data to destroy
- */
-static void set_size_data_destroy(void *obj)
-{
- struct set_size_data *ssd = obj;
- ao2_ref(ssd->pool, -1);
-}
-
/*!
* \brief Allocate and initialize a set_size_data
* \param pool The pool for the set_size_data
return NULL;
}
- ao2_ref(pool, +1);
ssd->pool = pool;
ssd->size = size;
return ssd;