[asterisk-commits] dlee: branch dlee/performance r399644 - /team/dlee/performance/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 23 14:14:48 CDT 2013


Author: dlee
Date: Mon Sep 23 14:14:46 2013
New Revision: 399644

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399644
Log:
Taskprocessor refcount insanity

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

Modified: team/dlee/performance/main/taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/taskprocessor.c?view=diff&rev=399644&r1=399643&r2=399644
==============================================================================
--- team/dlee/performance/main/taskprocessor.c (original)
+++ team/dlee/performance/main/taskprocessor.c Mon Sep 23 14:14:46 2013
@@ -179,6 +179,12 @@
 			dead = default_tps_idle(pvt);
 		}
 	}
+
+	/* Finish processing the queue */
+	while (ast_taskprocessor_execute(tps)) {
+		/* No-op */
+	}
+
 	return NULL;
 }
 
@@ -620,13 +626,17 @@
 		return NULL;
 	}
 
-	if (ao2_ref(tps, -1) > 3) {
-		return NULL;
-	}
-	/* If we're down to 3 references, then those must be:
+	ao2_lock(tps);
+	if (ao2_ref(tps, -1) > 3 + tps->tps_queue_size) {
+		ao2_unlock(tps);
+		return NULL;
+	}
+	ao2_unlock(tps);
+	/* If we're down to 3+n references, then those must be:
 	 * 1. The reference we just got rid of
 	 * 2. The container
 	 * 3. The listener
+	 * 4..n. The tasks currently in flight
 	 */
 	ao2_unlink(tps_singletons, tps);
 	listener_shutdown(tps->listener);




More information about the asterisk-commits mailing list