[svn-commits] trunk r26526 - /trunk/res/res_monitor.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed May 10 08:17:59 MST 2006


Author: russell
Date: Wed May 10 10:17:58 2006
New Revision: 26526

URL: http://svn.digium.com/view/asterisk?rev=26526&view=rev
Log:
use the channel lock wrappers (issue #7128)

Modified:
    trunk/res/res_monitor.c

Modified: trunk/res/res_monitor.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_monitor.c?rev=26526&r1=26525&r2=26526&view=diff
==============================================================================
--- trunk/res/res_monitor.c (original)
+++ trunk/res/res_monitor.c Wed May 10 10:17:58 2006
@@ -52,12 +52,12 @@
 
 #define LOCK_IF_NEEDED(lock, needed) do { \
 	if (needed) \
-		ast_mutex_lock(lock); \
+		ast_channel_lock(lock); \
 	} while(0)
 
 #define UNLOCK_IF_NEEDED(lock, needed) do { \
 	if (needed) \
-		ast_mutex_unlock(lock); \
+		ast_channel_unlock(lock); \
 	} while (0)
 
 static unsigned long seq = 0;
@@ -112,13 +112,13 @@
 
 static int ast_monitor_set_state(struct ast_channel *chan, int state)
 {
-	LOCK_IF_NEEDED(&chan->lock, 1);
+	LOCK_IF_NEEDED(chan, 1);
 	if (!chan->monitor) {
-		UNLOCK_IF_NEEDED(&chan->lock, 1);
+		UNLOCK_IF_NEEDED(chan, 1);
 		return -1;
 	}
 	chan->monitor->state = state;
-	UNLOCK_IF_NEEDED(&chan->lock, 1);
+	UNLOCK_IF_NEEDED(chan, 1);
 	return 0;
 }
 
@@ -129,7 +129,7 @@
 	int res = 0;
 	char tmp[256];
 
-	LOCK_IF_NEEDED(&chan->lock, need_lock);
+	LOCK_IF_NEEDED(chan, need_lock);
 
 	if (!(chan->monitor)) {
 		struct ast_channel_monitor *monitor;
@@ -144,7 +144,7 @@
 		}
 
 		if (!(monitor = ast_calloc(1, sizeof(*monitor)))) {
-			UNLOCK_IF_NEEDED(&chan->lock, need_lock);
+			UNLOCK_IF_NEEDED(chan, need_lock);
 			return -1;
 		}
 
@@ -226,7 +226,7 @@
 		res = -1;
 	}
 
-	UNLOCK_IF_NEEDED(&chan->lock, need_lock);
+	UNLOCK_IF_NEEDED(chan, need_lock);
 
 	return res;
 }
@@ -236,7 +236,7 @@
 {
 	int delfiles = 0;
 
-	LOCK_IF_NEEDED(&chan->lock, need_lock);
+	LOCK_IF_NEEDED(chan, need_lock);
 
 	if (chan->monitor) {
 		char filename[ FILENAME_MAX ];
@@ -305,7 +305,7 @@
 		chan->monitor = NULL;
 	}
 
-	UNLOCK_IF_NEEDED(&chan->lock, need_lock);
+	UNLOCK_IF_NEEDED(chan, need_lock);
 
 	return 0;
 }
@@ -342,7 +342,7 @@
 		return -1;
 	}
 
-	LOCK_IF_NEEDED(&chan->lock, need_lock);
+	LOCK_IF_NEEDED(chan, need_lock);
 
 	if (chan->monitor) {
 		int directory = strchr(fname_base, '/') ? 1 : 0;
@@ -359,7 +359,7 @@
 		ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", chan->name, fname_base);
 	}
 
-	UNLOCK_IF_NEEDED(&chan->lock, need_lock);
+	UNLOCK_IF_NEEDED(chan, need_lock);
 
 	return 0;
 }



More information about the svn-commits mailing list