[asterisk-commits] mmichelson: branch mmichelson/queue-penalty r93459 - /team/mmichelson/queue-p...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 17 17:06:59 CST 2007


Author: mmichelson
Date: Mon Dec 17 17:06:59 2007
New Revision: 93459

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93459
Log:
Add a lock around the entry of the penaltychange rules into a queue since realtime changes could
play havoc with this otherwise


Modified:
    team/mmichelson/queue-penalty/apps/app_queue.c

Modified: team/mmichelson/queue-penalty/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-penalty/apps/app_queue.c?view=diff&rev=93459&r1=93458&r2=93459
==============================================================================
--- team/mmichelson/queue-penalty/apps/app_queue.c (original)
+++ team/mmichelson/queue-penalty/apps/app_queue.c Mon Dec 17 17:06:59 2007
@@ -1028,6 +1028,7 @@
 	pr->value = change;
 
 	/*We have the rule made, now we need to insert it where it belongs*/
+	ao2_lock(q);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&q->rules, iter, list) {
 		if (pr->time < iter->time) {
 			AST_LIST_INSERT_BEFORE_CURRENT(pr, list);
@@ -1036,6 +1037,7 @@
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
+	ao2_unlock(q);
 
 	if (!inserted) {
 		AST_LIST_INSERT_TAIL(&q->rules, pr, list);




More information about the asterisk-commits mailing list