[Asterisk-cvs] asterisk channel.c,1.89,1.90

citats at lists.digium.com citats at lists.digium.com
Sat Mar 27 02:37:09 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2113

Modified Files:
	channel.c 
Log Message:
Fixup read/write locking


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- channel.c	27 Mar 2004 06:50:12 -0000	1.89
+++ channel.c	27 Mar 2004 07:34:37 -0000	1.90
@@ -1505,7 +1505,8 @@
 	int native;
 	int res;
 	
-	ast_mutex_lock(&chan->lock);
+	if (needlock)
+		ast_mutex_lock(&chan->lock);
 	native = chan->nativeformats;
 	fmt = fmts;
 	
@@ -1513,7 +1514,8 @@
 	if (res < 0) {
 		ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
 			ast_getformatname(fmts), ast_getformatname(chan->nativeformats));
-		ast_mutex_unlock(&chan->lock);
+		if (needlock)
+			ast_mutex_unlock(&chan->lock);
 		return -1;
 	}
 	
@@ -1528,7 +1530,8 @@
 	chan->pvt->writetrans = ast_translator_build_path(chan->pvt->rawwriteformat, chan->writeformat);
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Set channel %s to write format %s\n", chan->name, ast_getformatname(chan->writeformat));
-	ast_mutex_unlock(&chan->lock);
+	if (needlock)
+		ast_mutex_unlock(&chan->lock);
 	return 0;
 }
 
@@ -1547,7 +1550,8 @@
 	if (res < 0) {
 		ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
 			ast_getformatname(chan->nativeformats), ast_getformatname(fmts));
-		ast_mutex_unlock(&chan->lock);
+		if (needlock)
+			ast_mutex_unlock(&chan->lock);
 		return -1;
 	}
 	
@@ -1563,7 +1567,8 @@
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Set channel %s to read format %s\n", 
 			chan->name, ast_getformatname(chan->readformat));
-	ast_mutex_unlock(&chan->lock);
+	if (needlock)
+		ast_mutex_unlock(&chan->lock);
 	return 0;
 }
 




More information about the svn-commits mailing list