[asterisk-commits] pcadach: branch pcadach/chan_h323-live r41333 -
/team/pcadach/chan_h323-live/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Aug 30 06:36:32 MST 2006
Author: pcadach
Date: Wed Aug 30 08:36:31 2006
New Revision: 41333
URL: http://svn.digium.com/view/asterisk?rev=41333&view=rev
Log:
Switch to ast_channel_lock/unlock/trylock(channel) functions instead of ast_mutex_lock/unlock/trylock(&channel->lock)
Modified:
team/pcadach/chan_h323-live/channels/chan_h323.c
Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_h323.c?rev=41333&r1=41332&r2=41333&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Wed Aug 30 08:36:31 2006
@@ -376,10 +376,10 @@
/* Unlink us from the owner if we have one */
if (pvt->owner) {
- ast_mutex_lock(&pvt->owner->lock);
+ ast_channel_lock(pvt->owner);
ast_log(LOG_DEBUG, "Detaching from %s\n", pvt->owner->name);
pvt->owner->tech_pvt = NULL;
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
cur = iflist;
while(cur) {
@@ -616,7 +616,7 @@
if (f->frametype == AST_FRAME_VOICE) {
if (f->subclass != pvt->owner->nativeformats) {
/* Try to avoid deadlock */
- if (ast_mutex_trylock(&pvt->owner->lock)) {
+ if (ast_channel_trylock(pvt->owner)) {
ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n");
return &ast_null_frame;
}
@@ -625,13 +625,13 @@
pvt->nativeformats = f->subclass;
ast_set_read_format(pvt->owner, pvt->owner->readformat);
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
/* Do in-band DTMF detection */
if ((pvt->options.dtmfmode & H323_DTMF_INBAND) && pvt->vad) {
- if (!ast_mutex_trylock(&pvt->owner->lock)) {
+ if (!ast_channel_trylock(pvt->owner)) {
f = ast_dsp_process(pvt->owner,pvt->vad,f);
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
else
ast_log(LOG_NOTICE, "Unable to process inband DTMF while channel is locked\n");
@@ -954,11 +954,12 @@
{
if (!pvt)
return 0;
- if (pvt->owner && !ast_mutex_trylock(&pvt->owner->lock)) {
+ if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
if (state >= 0)
ast_setstate(pvt->owner, state);
if (signal >= 0)
ast_queue_control(pvt->owner, signal);
+ ast_channel_unlock(pvt->owner);
return 1;
}
else {
@@ -1219,7 +1220,7 @@
ast_log(LOG_ERROR, "Private structure not found in send_digit.\n");
return -1;
}
- if (pvt->owner && !ast_mutex_trylock(&pvt->owner->lock)) {
+ if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
if (digit == '!')
res = ast_queue_control(pvt->owner, AST_CONTROL_FLASH);
else {
@@ -1231,7 +1232,7 @@
};
res = ast_queue_frame(pvt->owner, &f);
}
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
} else {
if (digit == '!')
pvt->newcontrol = AST_CONTROL_FLASH;
@@ -1311,13 +1312,13 @@
}
rtptype = ast_rtp_lookup_pt(pvt->rtp, pt);
pvt->nativeformats = rtptype.code;
- if (pvt->owner && !ast_mutex_trylock(&pvt->owner->lock)) {
+ if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
pvt->owner->nativeformats = pvt->nativeformats;
ast_set_read_format(pvt->owner, pvt->owner->readformat);
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
if (pvt->options.progress_audio)
ast_queue_control(pvt->owner, AST_CONTROL_PROGRESS);
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
else {
if (pvt->options.progress_audio)
@@ -1362,8 +1363,7 @@
ast_mutex_unlock(&pvt->lock);
return;
}
- if (update_state(pvt, AST_STATE_UP, AST_CONTROL_ANSWER))
- ast_mutex_unlock(&pvt->owner->lock);
+ update_state(pvt, AST_STATE_UP, AST_CONTROL_ANSWER);
ast_mutex_unlock(&pvt->lock);
return;
}
@@ -1384,8 +1384,7 @@
ast_log(LOG_ERROR, "No Asterisk channel associated with private structure.\n");
return -1;
}
- if (update_state(pvt, -1, (inband ? AST_CONTROL_PROGRESS : AST_CONTROL_RINGING)))
- ast_mutex_unlock(&pvt->owner->lock);
+ update_state(pvt, -1, (inband ? AST_CONTROL_PROGRESS : AST_CONTROL_RINGING));
ast_mutex_unlock(&pvt->lock);
return 0;
@@ -1572,8 +1571,7 @@
ast_log(LOG_ERROR, "Channel has no owner\n");
return;
}
- if (update_state(pvt, AST_STATE_RINGING, AST_CONTROL_RINGING))
- ast_mutex_unlock(&pvt->owner->lock);
+ update_state(pvt, AST_STATE_RINGING, AST_CONTROL_RINGING);
ast_mutex_unlock(&pvt->lock);
return;
}
@@ -1595,7 +1593,7 @@
ast_log(LOG_DEBUG, "No connection for %s\n", call_token);
return;
}
- if (!pvt->owner || !ast_mutex_trylock(&pvt->owner->lock))
+ if (!pvt->owner || !ast_channel_trylock(pvt->owner))
break;
#if 1
#ifdef DEBUG_THREADS
@@ -1623,7 +1621,7 @@
if (pvt->owner) {
pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_queue_hangup(pvt->owner);
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
ast_mutex_unlock(&pvt->lock);
if (h323debug)
@@ -1646,11 +1644,11 @@
}
return;
}
- if (pvt->owner && !ast_mutex_trylock(&pvt->owner->lock)) {
+ if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
pvt->owner->hangupcause = pvt->hangupcause = cause;
ast_queue_hangup(pvt->owner);
- ast_mutex_unlock(&pvt->owner->lock);
+ ast_channel_unlock(pvt->owner);
}
else {
pvt->needhangup = 1;
More information about the asterisk-commits
mailing list