[asterisk-commits] dlee: branch dlee/performance r399350 - /team/dlee/performance/main/stasis.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 18 12:14:01 CDT 2013


Author: dlee
Date: Wed Sep 18 12:14:00 2013
New Revision: 399350

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399350
Log:
Replace threadpool/serializer with taskprocessor

Modified:
    team/dlee/performance/main/stasis.c

Modified: team/dlee/performance/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/stasis.c?view=diff&rev=399350&r1=399349&r2=399350
==============================================================================
--- team/dlee/performance/main/stasis.c (original)
+++ team/dlee/performance/main/stasis.c Wed Sep 18 12:14:00 2013
@@ -134,9 +134,6 @@
 /*! The number of buckets to use for topic pools */
 #define TOPIC_POOL_BUCKETS 57
 
-/*! Threadpool for dispatching notifications to subscribers */
-static struct ast_threadpool *pool;
-
 STASIS_MESSAGE_TYPE_DEFN(stasis_subscription_change_type);
 
 /*! \internal */
@@ -286,7 +283,8 @@
 	ast_uuid_generate_str(sub->uniqueid, sizeof(sub->uniqueid));
 
 	if (needs_mailbox) {
-		sub->mailbox = ast_threadpool_serializer(sub->uniqueid, pool);
+		sub->mailbox = ast_taskprocessor_get(sub->uniqueid,
+			TPS_REF_DEFAULT);
 		if (!sub->mailbox) {
 			return NULL;
 		}
@@ -542,7 +540,6 @@
 				break;
 			}
 
-#if 0
 			if (ast_taskprocessor_push(sub->mailbox, dispatch_exec, dispatch) == 0) {
 				/* Ownership transferred to mailbox.
 				 * Don't increment ref, b/c the task processor
@@ -550,12 +547,6 @@
 				 */
 				dispatch = NULL;
 			}
-#else
-			ao2_lock(sub);
-			dispatch_exec(dispatch);
-			dispatch = NULL;
-			ao2_unlock(sub);
-#endif
 		} else {
 			/* Dispatch directly */
 			subscription_invoke(sub, publisher_topic, message);
@@ -741,8 +732,6 @@
 /*! \brief Shutdown function */
 static void stasis_exit(void)
 {
-	ast_threadpool_shutdown(pool);
-	pool = NULL;
 }
 
 /*! \brief Cleanup function for graceful shutdowns */
@@ -754,8 +743,6 @@
 int stasis_init(void)
 {
 	int cache_init;
-
-	struct ast_threadpool_options opts;
 
 	/* Be sure the types are cleaned up after the message bus */
 	ast_register_cleanup(stasis_cleanup);
@@ -771,20 +758,6 @@
 		return -1;
 	}
 
-	if (pool) {
-		ast_log(LOG_ERROR, "Stasis double-initialized\n");
-		return -1;
-	}
-
-	stasis_config_get_threadpool_options(&opts);
-	ast_debug(3, "Creating Stasis threadpool: initial_size = %d, max_size = %d, idle_timeout_secs = %d\n",
-		opts.initial_size, opts.max_size, opts.idle_timeout);
-	pool = ast_threadpool_create("stasis-core", NULL, &opts);
-	if (!pool) {
-		ast_log(LOG_ERROR, "Stasis threadpool allocation failed\n");
-		return -1;
-	}
-
 	cache_init = stasis_cache_init();
 	if (cache_init != 0) {
 		return -1;




More information about the asterisk-commits mailing list