[Asterisk-code-review] threadpool: Handle worker thread transitioning to dead when ... (asterisk[13])

Mark Michelson asteriskteam at digium.com
Wed Nov 11 12:18:09 CST 2015


Mark Michelson has posted comments on this change.

Change subject: threadpool: Handle worker thread transitioning to dead when going active.
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/1602/1/main/threadpool.c
File main/threadpool.c:

Line 824: 	if (current_size == num_threads) {
        : 		ast_debug(3, "Not changing threadpool size since new size %u is the same as current %u\n",
        : 			  num_threads, current_size);
        : 		return 0;
        : 	}
        : 
        : 	if (current_size < num_threads) {
        : 		ao2_callback(pool->idle_threads, OBJ_UNLINK | OBJ_NOLOCK | OBJ_NODATA | OBJ_MULTIPLE,
        : 				activate_thread, pool);
        : 
        : 		/* As the above may have altered the number of current threads update it */
        : 		current_size = ao2_container_count(pool->active_threads) +
        : 			ao2_container_count(pool->idle_threads);
Would it be worthwhile to run a round of thread activation before doing any current_size comparision to num_threads? This way, we get a corrected current size immediately and can mostly leave the logic here the same.


-- 
To view, visit https://gerrit.asterisk.org/1602
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list