[asterisk-commits] mmichelson: branch mmichelson/pool_shark r380513 - /team/mmichelson/pool_shar...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 30 10:48:33 CST 2013
Author: mmichelson
Date: Wed Jan 30 10:48:29 2013
New Revision: 380513
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380513
Log:
Change where we bump the work refcount.
Bumping the refcount before we push a task makes a lot more sense than
bumping once the task executes. This ensures that at the beginning of
task execution, the work reference is still valid.
Modified:
team/mmichelson/pool_shark/res/res_sip.c
Modified: team/mmichelson/pool_shark/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/res/res_sip.c?view=diff&rev=380513&r1=380512&r2=380513
==============================================================================
--- team/mmichelson/pool_shark/res/res_sip.c (original)
+++ team/mmichelson/pool_shark/res/res_sip.c Wed Jan 30 10:48:29 2013
@@ -377,12 +377,6 @@
static int execute_tasks(void *data)
{
struct ast_sip_work *work = data;
- /* We bump the refcount of work here so that in case the task
- * that gets run calls ast_sip_destroy_work(), the work won't
- * actually get destroyed until the end of this function
- */
- ao2_ref(work, +1);
- while (ast_taskprocessor_execute(work->queue));
ao2_cleanup(work);
return 0;
}
@@ -390,6 +384,7 @@
static void work_queue_task_pushed(struct ast_taskprocessor_listener *listener, int was_empty) {
if (was_empty) {
struct ast_sip_work *work = ast_taskprocessor_listener_get_user_data(listener);
+ ao2_ref(work, +1);
ast_threadpool_push(sip_threadpool, execute_tasks, work);
}
};
More information about the asterisk-commits
mailing list