Skip to content
Snippets Groups Projects
Commit 932c5c7f authored by Russell Bryant's avatar Russell Bryant
Browse files

use the channel lock wrappers (issue #7120, Mithraen)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent e0f0f4b4
Branches
Tags
No related merge requests found
...@@ -198,9 +198,9 @@ static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, s ...@@ -198,9 +198,9 @@ static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, s
ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name); ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name);
ast_mutex_lock(&chan->lock); ast_channel_lock(chan);
res = ast_channel_spy_add(chan, spy); res = ast_channel_spy_add(chan, spy);
ast_mutex_unlock(&chan->lock); ast_channel_unlock(chan);
if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) { if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE); ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
...@@ -219,9 +219,9 @@ static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy) ...@@ -219,9 +219,9 @@ static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
if (!chan) if (!chan)
return; return;
ast_mutex_lock(&chan->lock); ast_channel_lock(chan);
ast_channel_spy_remove(chan, spy); ast_channel_spy_remove(chan, spy);
ast_mutex_unlock(&chan->lock); ast_channel_unlock(chan);
}; };
/* Map 'volume' levels from -4 through +4 into /* Map 'volume' levels from -4 through +4 into
......
...@@ -93,9 +93,9 @@ static int sendtext_exec(struct ast_channel *chan, void *data) ...@@ -93,9 +93,9 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
priority_jump = 1; priority_jump = 1;
} }
ast_mutex_lock(&chan->lock); ast_channel_lock(chan);
if (!chan->tech->send_text) { if (!chan->tech->send_text) {
ast_mutex_unlock(&chan->lock); ast_channel_unlock(chan);
/* Does not support transport */ /* Does not support transport */
if (priority_jump || ast_opt_priority_jumping) if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
...@@ -103,7 +103,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data) ...@@ -103,7 +103,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
return 0; return 0;
} }
status = "FAILURE"; status = "FAILURE";
ast_mutex_unlock(&chan->lock); ast_channel_unlock(chan);
res = ast_sendtext(chan, args.text); res = ast_sendtext(chan, args.text);
if (!res) if (!res)
status = "SUCCESS"; status = "SUCCESS";
......
...@@ -40,15 +40,15 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ...@@ -40,15 +40,15 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h" #include "asterisk/stringfields.h"
#define locked_copy_string(chan, dest, source, len) \ #define locked_copy_string(chan, dest, source, len) \
do { \ do { \
ast_mutex_lock(&chan->lock); \ ast_channel_lock(chan); \
ast_copy_string(dest, source, len); \ ast_copy_string(dest, source, len); \
ast_mutex_unlock(&chan->lock); \ ast_channel_unlock(chan); \
} while (0) } while (0)
#define locked_string_field_set(chan, field, source) \ #define locked_string_field_set(chan, field, source) \
do { \ do { \
ast_mutex_lock(&chan->lock); \ ast_channel_lock(chan); \
ast_string_field_set(chan, field, source); \ ast_string_field_set(chan, field, source); \
ast_mutex_unlock(&chan->lock); \ ast_channel_unlock(chan); \
} while (0) } while (0)
static int func_channel_read(struct ast_channel *chan, char *function, static int func_channel_read(struct ast_channel *chan, char *function,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment