[asterisk-commits] russell: trunk r73127 - /trunk/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 3 13:25:30 CDT 2007


Author: russell
Date: Tue Jul  3 13:25:30 2007
New Revision: 73127

URL: http://svn.digium.com/view/asterisk?view=rev&rev=73127
Log:
Fix up the device state processing thread in app_queue so that it's not
possible for their to be entries in the queue and the thread is just sleeping
(Thanks to mmichelson for bringing the problem to my attention)

Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=73127&r1=73126&r2=73127
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Jul  3 13:25:30 2007
@@ -631,8 +631,10 @@
 
 	while (!device_state.stop) {
 		ast_mutex_lock(&device_state.lock);
-		ast_cond_wait(&device_state.cond, &device_state.lock);
-		sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry);
+		if (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
+			ast_cond_wait(&device_state.cond, &device_state.lock);
+			sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry);
+		}
 		ast_mutex_unlock(&device_state.lock);
 
 		/* Check to see if we were woken up to see the request to stop */




More information about the asterisk-commits mailing list