[asterisk-commits] mmichelson: branch mmichelson/pool_shark r380447 - /team/mmichelson/pool_shar...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 29 18:24:50 CST 2013


Author: mmichelson
Date: Tue Jan 29 18:24:46 2013
New Revision: 380447

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380447
Log:
Only push tasks to the threadpool if the SIP work's taskprocessor was empty.

The problem here is that unconditionally pushing the task to the threadpool results
in the possibility of having a thread attempt to work on a freed SIP work structure.
Bad!


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=380447&r1=380446&r2=380447
==============================================================================
--- team/mmichelson/pool_shark/res/res_sip.c (original)
+++ team/mmichelson/pool_shark/res/res_sip.c Tue Jan 29 18:24:46 2013
@@ -388,8 +388,10 @@
 }
 
 static void work_queue_task_pushed(struct ast_taskprocessor_listener *listener, int was_empty) {
-	struct ast_sip_work *work = ast_taskprocessor_listener_get_user_data(listener);
-	ast_threadpool_push(sip_threadpool, execute_tasks, work);
+	if (was_empty) {
+		struct ast_sip_work *work = ast_taskprocessor_listener_get_user_data(listener);
+		ast_threadpool_push(sip_threadpool, execute_tasks, work);
+	}
 };
 
 static int work_queue_start(struct ast_taskprocessor_listener *listener)




More information about the asterisk-commits mailing list