[asterisk-commits] bweschke: trunk r46372 - /trunk/apps/app_queue.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Oct 27 12:28:34 MST 2006


Author: bweschke
Date: Fri Oct 27 14:28:34 2006
New Revision: 46372

URL: http://svn.digium.com/view/asterisk?rev=46372&view=rev
Log:
 Let's make sure we hold the mutex lock before we go looking at values in the queue structure that could potentially be changing while we're running.


Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?rev=46372&r1=46371&r2=46372&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Oct 27 14:28:34 2006
@@ -1842,8 +1842,8 @@
 
 static void record_abandoned(struct queue_ent *qe)
 {
+	ast_mutex_lock(&qe->parent->lock);
 	set_queue_variables(qe);
-	ast_mutex_lock(&qe->parent->lock);
 	manager_event(EVENT_FLAG_AGENT, "QueueCallerAbandon",
 		"Queue: %s\r\n"
 		"Uniqueid: %s\r\n"
@@ -2615,6 +2615,7 @@
 			ast_channel_sendurl(peer, url);
 		}
 		
+		ast_mutex_lock(&qe->parent->lock);
 		/* if setinterfacevar is defined, make member variables available to the channel */
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setinterfacevar) {
@@ -2633,6 +2634,7 @@
 	
 		/* try to set queue variables if configured to do so*/
 		set_queue_variables(qe);
+		ast_mutex_unlock(&qe->parent->lock);
 		
 		/* run a macro for this connection if defined. The macro simply returns, no action is taken on the result */
 		/* use macro from dialplan if passed as a option, otherwise use the default queue macro */



More information about the asterisk-commits mailing list