[asterisk-commits] rmudgett: trunk r382295 - /trunk/main/threadpool.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 28 15:31:18 CST 2013


Author: rmudgett
Date: Thu Feb 28 15:31:14 2013
New Revision: 382295

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382295
Log:
threadpool: Make ast_threadpool_push() return -1 if shutting_down

Modified:
    trunk/main/threadpool.c

Modified: trunk/main/threadpool.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/threadpool.c?view=diff&rev=382295&r1=382294&r2=382295
==============================================================================
--- trunk/main/threadpool.c (original)
+++ trunk/main/threadpool.c Thu Feb 28 15:31:14 2013
@@ -898,7 +898,7 @@
 	if (!pool->shutting_down) {
 		return ast_taskprocessor_push(pool->tps, task, data);
 	}
-	return 0;
+	return -1;
 }
 
 void ast_threadpool_shutdown(struct ast_threadpool *pool)
@@ -1143,7 +1143,9 @@
 		struct serializer *ser = ast_taskprocessor_listener_get_user_data(listener);
 		struct ast_taskprocessor *tps = ast_taskprocessor_listener_get_tps(listener);
 
-		ast_threadpool_push(ser->pool, execute_tasks, tps);
+		if (ast_threadpool_push(ser->pool, execute_tasks, tps)) {
+			ast_taskprocessor_unreference(tps);
+		}
 	}
 }
 




More information about the asterisk-commits mailing list