[Asterisk-cvs] asterisk channel.c,1.115,1.116

markster at lists.digium.com markster at lists.digium.com
Wed Jun 2 16:01:51 CDT 2004


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

Modified Files:
	channel.c 
Log Message:
Lock while installign generator


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- channel.c	27 May 2004 16:50:07 -0000	1.115
+++ channel.c	2 Jun 2004 20:18:18 -0000	1.116
@@ -786,6 +786,8 @@
 
 int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
 {
+	int res = 0;
+	ast_mutex_lock(&chan->lock);
 	if (chan->generatordata) {
 		if (chan->generator && chan->generator->release)
 			chan->generator->release(chan, chan->generatordata);
@@ -795,9 +797,10 @@
 	if ((chan->generatordata = gen->alloc(chan, params))) {
 		chan->generator = gen;
 	} else {
-		return -1;
+		res = -1;
 	}
-	return 0;
+	ast_mutex_unlock(&chan->lock);
+	return res;
 }
 
 int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)




More information about the svn-commits mailing list