[Asterisk-cvs] asterisk devicestate.c,1.1,1.2

markster at lists.digium.com markster at lists.digium.com
Sun Jul 10 08:01:16 CDT 2005


Update of /usr/cvsroot/asterisk
In directory localhost.localdomain:/tmp/cvs-serv13669

Modified Files:
	devicestate.c 
Log Message:
Fix lock ordering in devicestate


Index: devicestate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/devicestate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- devicestate.c	8 Jul 2005 21:15:41 -0000	1.1
+++ devicestate.c	10 Jul 2005 12:09:40 -0000	1.2
@@ -184,12 +184,14 @@
 		AST_LIST_LOCK(&state_changes);
 		AST_LIST_INSERT_TAIL(&state_changes, change, list);
 		if (AST_LIST_FIRST(&state_changes) == change) {
+			AST_LIST_UNLOCK(&state_changes);
 			/* the list was empty, signal the thread */
 			ast_mutex_lock(&change_pending_lock);
 			pthread_cond_signal(&change_pending);
 			ast_mutex_unlock(&change_pending_lock);
+		} else {
+			AST_LIST_UNLOCK(&state_changes);
 		}
-		AST_LIST_UNLOCK(&state_changes);
 	}
 
 	return 1;




More information about the svn-commits mailing list