aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c214
1 files changed, 107 insertions, 107 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 382890e05..09a2db606 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -200,14 +200,14 @@ static int gendigittimeout = 8000;
static int matchdigittimeout = 3000;
static int usecnt =0;
-static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
+static ast_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
/* Protect the interface list (of zt_pvt's) */
-static pthread_mutex_t iflock = AST_MUTEX_INITIALIZER;
+static ast_mutex_t iflock = AST_MUTEX_INITIALIZER;
/* Protect the monitoring thread, so only one process can kill or start it, and not
when it's doing something critical. */
-static pthread_mutex_t monlock = AST_MUTEX_INITIALIZER;
+static ast_mutex_t monlock = AST_MUTEX_INITIALIZER;
/* This is the thread for the monitor which checks for input on the channels
which are not currently in use. */
@@ -260,7 +260,7 @@ static int r2prot = -1;
#ifdef ZAPATA_PRI
struct zt_pri {
pthread_t master; /* Thread of master */
- pthread_mutex_t lock; /* Mutex */
+ ast_mutex_t lock; /* Mutex */
char idleext[AST_MAX_EXTENSION]; /* Where to idle extra calls */
char idlecontext[AST_MAX_EXTENSION]; /* What context to use for idle */
char idledial[AST_MAX_EXTENSION]; /* What to dial before dumping */
@@ -299,7 +299,7 @@ static int pritype = PRI_CPE;
static inline void pri_rel(struct zt_pri *pri)
{
- ast_pthread_mutex_unlock(&pri->lock);
+ ast_mutex_unlock(&pri->lock);
}
static int switchtype = PRI_SWITCH_NI2;
@@ -337,7 +337,7 @@ struct zt_subchannel {
#define MAX_SLAVES 4
static struct zt_pvt {
- pthread_mutex_t lock;
+ ast_mutex_t lock;
struct ast_channel *owner; /* Our current active owner (if applicable) */
/* Up to three channels can be associated with this call */
@@ -457,12 +457,12 @@ static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
int res;
/* Grab the lock first */
do {
- res = pthread_mutex_trylock(&pri->lock);
+ res = ast_mutex_trylock(&pri->lock);
if (res) {
- ast_pthread_mutex_unlock(&pvt->lock);
+ ast_mutex_unlock(&pvt->lock);
/* Release the lock and try again */
usleep(1);
- ast_pthread_mutex_lock(&pvt->lock);
+ ast_mutex_lock(&pvt->lock);
}
} while(res);
/* Then break the select */
@@ -1490,7 +1490,7 @@ static int zt_hangup(struct ast_channel *ast)
return 0;
}
- ast_pthread_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
index = zt_get_index(ast, p, 1);
@@ -1726,17 +1726,17 @@ static int zt_hangup(struct ast_channel *ast)
p->callwaitingrepeat = 0;
p->cidcwexpire = 0;
ast->pvt->pvt = NULL;
- ast_pthread_mutex_unlock(&p->lock);
- ast_pthread_mutex_lock(&usecnt_lock);
+ ast_mutex_unlock(&p->lock);
+ ast_mutex_lock(&usecnt_lock);
usecnt--;
if (usecnt < 0)
ast_log(LOG_WARNING, "Usecnt < 0???\n");
- ast_pthread_mutex_unlock(&usecnt_lock);
+ ast_mutex_unlock(&usecnt_lock);
ast_update_use_count();
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Hungup '%s'\n", ast->name);
- ast_pthread_mutex_lock(&iflock);
+ ast_mutex_lock(&iflock);
tmp = iflist;
prev = NULL;
if (p->destroy) {
@@ -1750,7 +1750,7 @@ static int zt_hangup(struct ast_channel *ast)
}
}
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return 0;
}
@@ -1761,13 +1761,13 @@ static int zt_answer(struct ast_channel *ast)
int index;
int oldstate = ast->_state;
ast_setstate(ast, AST_STATE_UP);
- ast_pthread_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
index = zt_get_index(ast, p, 0);
if (index < 0)
index = SUB_REAL;
/* nothing to do if a radio channel */
if (p->radio) {
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return 0;
}
switch(p->sig) {
@@ -1823,13 +1823,13 @@ static int zt_answer(struct ast_channel *ast)
break;
#endif
case 0:
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return 0;
default:
ast_log(LOG_WARNING, "Don't know how to answer signalling %d (channel %d)\n", p->sig, p->channel);
res = -1;
}
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -2061,8 +2061,8 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
/* cant do pseudo-channels here */
if ((!p0->sig) || (!p1->sig)) return -2;
- ast_pthread_mutex_lock(&c0->lock);
- ast_pthread_mutex_lock(&c1->lock);
+ ast_mutex_lock(&c0->lock);
+ ast_mutex_lock(&c1->lock);
op0 = p0 = c0->pvt->pvt;
op1 = p1 = c1->pvt->pvt;
ofd1 = c0->fds[0];
@@ -2076,12 +2076,12 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
- ast_pthread_mutex_lock(&p0->lock);
- if (pthread_mutex_trylock(&p1->lock)) {
+ ast_mutex_lock(&p0->lock);
+ if (ast_mutex_trylock(&p1->lock)) {
/* Don't block, due to potential for deadlock */
- ast_pthread_mutex_unlock(&p0->lock);
- ast_pthread_mutex_unlock(&c0->lock);
- ast_pthread_mutex_unlock(&c1->lock);
+ ast_mutex_unlock(&p0->lock);
+ ast_mutex_unlock(&c0->lock);
+ ast_mutex_unlock(&c1->lock);
ast_log(LOG_NOTICE, "Avoiding deadlock...\n");
return -3;
}
@@ -2184,11 +2184,11 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
t1 = p0->subs[SUB_REAL].inthreeway;
t2 = p1->subs[SUB_REAL].inthreeway;
- ast_pthread_mutex_unlock(&p0->lock);
- ast_pthread_mutex_unlock(&p1->lock);
+ ast_mutex_unlock(&p0->lock);
+ ast_mutex_unlock(&p1->lock);
- ast_pthread_mutex_unlock(&c0->lock);
- ast_pthread_mutex_unlock(&c1->lock);
+ ast_mutex_unlock(&c0->lock);
+ ast_mutex_unlock(&c1->lock);
/* Native bridge failed */
if ((!master || !slave) && !nothingok) {
@@ -2205,16 +2205,16 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
for (;;) {
/* Here's our main loop... Start by locking things, looking for private parts,
and then balking if anything is wrong */
- ast_pthread_mutex_lock(&c0->lock);
- ast_pthread_mutex_lock(&c1->lock);
+ ast_mutex_lock(&c0->lock);
+ ast_mutex_lock(&c1->lock);
p0 = c0->pvt->pvt;
p1 = c1->pvt->pvt;
if (op0 == p0)
i1 = zt_get_index(c0, p0, 1);
if (op1 == p1)
i2 = zt_get_index(c1, p1, 1);
- ast_pthread_mutex_unlock(&c0->lock);
- ast_pthread_mutex_unlock(&c1->lock);
+ ast_mutex_unlock(&c0->lock);
+ ast_mutex_unlock(&c1->lock);
if ((op0 != p0) || (op1 != p1) ||
(ofd1 != c0->fds[0]) ||
(ofd2 != c1->fds[0]) ||
@@ -2984,7 +2984,7 @@ struct ast_frame *zt_exception(struct ast_channel *ast)
int index;
struct ast_frame *f;
- ast_pthread_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
index = zt_get_index(ast, p, 1);
@@ -3062,7 +3062,7 @@ struct ast_frame *zt_exception(struct ast_channel *ast)
ast_log(LOG_WARNING, "Don't know how to absorb event %s\n", event2str(res));
}
f = &p->subs[index].f;
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return f;
}
if (!p->radio) ast_log(LOG_DEBUG, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
@@ -3070,11 +3070,11 @@ struct ast_frame *zt_exception(struct ast_channel *ast)
if (ast != p->owner) {
ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
f = &p->subs[index].f;
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return f;
}
f = zt_handle_event(ast);
- ast_pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return f;
}
@@ -3087,7 +3087,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
struct ast_frame *f;
- ast_pthread_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
index = zt_get_index(ast, p, 0);
@@ -3103,7 +3103,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
/* Hang up if we don't really exist */
if (index < 0) {
ast_log(LOG_WARNING, "We dont exist?\n");
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return NULL;
}
@@ -3125,11 +3125,11 @@ struct ast_frame *zt_read(struct ast_channel *ast)
{
p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
}
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
}
if (p->ringt == 1) {
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return NULL;
}
else if (p->ringt > 0)
@@ -3141,7 +3141,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RINGING;
ast_setstate(ast, AST_STATE_RINGING);
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
}
@@ -3156,7 +3156,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
ast_setstate(ast, AST_STATE_UP);
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
}
@@ -3177,7 +3177,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
}
} else {
ast_log(LOG_WARNING, "Don't know how to read frames in format %d\n", ast->pvt->rawreadformat);
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return NULL;
}
readbuf = ((unsigned char *)p->subs[index].buffer) + AST_FRIENDLY_OFFSET;
@@ -3189,18 +3189,18 @@ struct ast_frame *zt_read(struct ast_channel *ast)
if (res == -1) {
if (errno == EAGAIN) {
/* Return "NULL" frame if there is nobody there */
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
} else
ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
}
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return NULL;
}
if (res != (p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE)) {
ast_log(LOG_DEBUG, "Short read (%d/%d), must be an event...\n", res, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
f = zt_handle_event(ast);
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return f;
}
if (p->tdd) { /* if in TDD mode, see if we receive that */
@@ -3219,7 +3219,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.data = p->subs[index].buffer + AST_FRIENDLY_OFFSET;
p->subs[index].f.datalen = 1;
*((char *) p->subs[index].f.data) = c;
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
}
}
@@ -3354,7 +3354,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
f = &p->subs[index].f;
}
#endif
- pthread_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return f;
}
@@ -3621,9 +3621,9 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
}
i->subs[index].owner = tmp;
ast_setstate(tmp, state);
- ast_pthread_mutex_lock(&usecnt_lock);
+ ast_mutex_lock(&usecnt_lock);
usecnt++;
- ast_pthread_mutex_unlock(&usecnt_lock);
+ ast_mutex_unlock(&usecnt_lock);
ast_update_use_count();
strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
/* Copy call forward info */
@@ -4484,7 +4484,7 @@ static void *do_monitor(void *data)
#endif
for(;;) {
/* Lock the interface list */
- if (ast_pthread_mutex_lock(&iflock)) {
+ if (ast_mutex_lock(&iflock)) {
ast_log(LOG_ERROR, "Unable to grab interface lock\n");
return NULL;
}
@@ -4515,7 +4515,7 @@ static void *do_monitor(void *data)
i = i->next;
}
/* Okay, now that we know what to do, release the interface lock */
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
pthread_testcancel();
/* Wait at least a second for something to happen */
@@ -4531,7 +4531,7 @@ static void *do_monitor(void *data)
}
/* Alright, lock the interface list again, and let's look and see what has
happened */
- if (ast_pthread_mutex_lock(&iflock)) {
+ if (ast_mutex_lock(&iflock)) {
ast_log(LOG_WARNING, "Unable to lock the interface list\n");
continue;
}
@@ -4649,7 +4649,7 @@ static void *do_monitor(void *data)
}
i=i->next;
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
}
/* Never reached */
return NULL;
@@ -4664,12 +4664,12 @@ static int restart_monitor(void)
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == -2)
return 0;
- if (ast_pthread_mutex_lock(&monlock)) {
+ if (ast_mutex_lock(&monlock)) {
ast_log(LOG_WARNING, "Unable to lock monitor\n");
return -1;
}
if (monitor_thread == pthread_self()) {
- ast_pthread_mutex_unlock(&monlock);
+ ast_mutex_unlock(&monlock);
ast_log(LOG_WARNING, "Cannot kill myself\n");
return -1;
}
@@ -4685,7 +4685,7 @@ static int restart_monitor(void)
} else {
/* Start a new monitor */
if (pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
- ast_pthread_mutex_unlock(&monlock);
+ ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
}
@@ -4693,7 +4693,7 @@ static int restart_monitor(void)
#if 0
printf("Created thread %ld detached in restart monitor\n", monitor_thread);
#endif
- ast_pthread_mutex_unlock(&monlock);
+ ast_mutex_unlock(&monlock);
return 0;
}
@@ -5006,7 +5006,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio)
tmp->propconfno = -1;
}
tmp->transfer = transfer;
- ast_pthread_mutex_init(&tmp->lock);
+ ast_mutex_init(&tmp->lock);
strncpy(tmp->language, language, sizeof(tmp->language)-1);
strncpy(tmp->musicclass, musicclass, sizeof(tmp->musicclass)-1);
strncpy(tmp->context, context, sizeof(tmp->context)-1);
@@ -5211,7 +5211,7 @@ static struct ast_channel *zt_request(char *type, int format, void *data)
channelmatch = x;
}
/* Search for an unowned channel */
- if (ast_pthread_mutex_lock(&iflock)) {
+ if (ast_mutex_lock(&iflock)) {
ast_log(LOG_ERROR, "Unable to lock interface list???\n");
return NULL;
}
@@ -5270,7 +5270,7 @@ static struct ast_channel *zt_request(char *type, int format, void *data)
else
p = p->next;
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
restart_monitor();
return tmp;
}
@@ -5457,7 +5457,7 @@ static void *pri_dchannel(void *vpri)
FD_SET(pri->fd, &rfds);
FD_SET(pri->fd, &efds);
time(&t);
- ast_pthread_mutex_lock(&pri->lock);
+ ast_mutex_lock(&pri->lock);
if (pri->resetting && pri->up) {
if (!pri->resetchannel)
pri_check_restart(pri);
@@ -5561,12 +5561,12 @@ static void *pri_dchannel(void *vpri)
tv.tv_sec = 60;
tv.tv_usec = 0;
}
- pthread_mutex_unlock(&pri->lock);
+ ast_mutex_unlock(&pri->lock);
e = NULL;
res = ast_select(pri->fd + 1, &rfds, NULL, &efds, &tv);
- ast_pthread_mutex_lock(&pri->lock);
+ ast_mutex_lock(&pri->lock);
if (!res) {
/* Just a timeout, run the scheduler */
e = pri_schedule_run(pri->pri);
@@ -5606,21 +5606,21 @@ static void *pri_dchannel(void *vpri)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "B-channel %d restarted on span %d\n",
chan, pri->span);
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
/* Force soft hangup if appropriate */
if (pri->pvt[chan]->owner)
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
}
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_2 "Restart on requested on entire span %d\n", pri->span);
for (x=1;x <= pri->channels;x++)
if ((x != pri->dchannel) && pri->pvt[x]) {
- ast_pthread_mutex_lock(&pri->pvt[x]->lock);
+ ast_mutex_lock(&pri->pvt[x]->lock);
if (pri->pvt[x]->owner)
pri->pvt[x]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
- ast_pthread_mutex_unlock(&pri->pvt[x]->lock);
+ ast_mutex_unlock(&pri->pvt[x]->lock);
}
}
break;
@@ -5876,7 +5876,7 @@ static void *pri_dchannel(void *vpri)
if (chan) {
chan = pri_fixup(pri, chan, e->hangup.call);
if (chan) {
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
if (!pri->pvt[chan]->alreadyhungup) {
/* we're calling here zt_hangup so once we get there we need to clear p->call after calling pri_hangup */
pri->pvt[chan]->alreadyhungup = 1;
@@ -5894,7 +5894,7 @@ static void *pri_dchannel(void *vpri)
pri_reset(pri->pri, chan);
pri->pvt[chan]->resetting = 1;
}
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
} else {
ast_log(LOG_WARNING, "Hangup on bad channel %d\n", e->hangup.channel);
}
@@ -5915,7 +5915,7 @@ static void *pri_dchannel(void *vpri)
if (chan) {
chan = pri_fixup(pri, chan, e->hangup.call);
if (chan) {
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
if (pri->pvt[chan]->owner) {
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
if (option_verbose > 2)
@@ -5927,7 +5927,7 @@ static void *pri_dchannel(void *vpri)
pri_reset(pri->pri, chan);
pri->pvt[chan]->resetting = 1;
}
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
} else {
ast_log(LOG_WARNING, "Hangup REQ on bad channel %d\n", e->hangup.channel);
}
@@ -5945,14 +5945,14 @@ static void *pri_dchannel(void *vpri)
if (chan) {
chan = pri_fixup(pri, chan, e->hangup.call);
if (chan) {
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
pri->pvt[chan]->call = NULL;
pri->pvt[chan]->resetting = 0;
if (pri->pvt[chan]->owner) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %d, span %d got hangup ACK\n", chan, pri->span);
}
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
}
}
break;
@@ -5968,7 +5968,7 @@ static void *pri_dchannel(void *vpri)
for (x=1;x<=pri->channels;x++) {
if (pri->pvt[x] && pri->pvt[x]->resetting) {
chan = x;
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d span %d\n", chan, pri->span);
if (pri->pvt[chan]->owner) {
ast_log(LOG_WARNING, "Got restart ack on channel %d with owner\n", chan);
@@ -5977,7 +5977,7 @@ static void *pri_dchannel(void *vpri)
pri->pvt[chan]->resetting = 0;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "B-channel %d successfully restarted on span %d\n", chan, pri->span);
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
if (pri->resetting)
pri_check_restart(pri);
break;
@@ -5993,7 +5993,7 @@ static void *pri_dchannel(void *vpri)
}
if ((chan >= 1) && (chan <= pri->channels)) {
if (pri->pvt[chan]) {
- ast_pthread_mutex_lock(&pri->pvt[chan]->lock);
+ ast_mutex_lock(&pri->pvt[chan]->lock);
if (pri->pvt[chan]->owner) {
ast_log(LOG_WARNING, "Got restart ack on channel %d with owner\n", chan);
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -6001,7 +6001,7 @@ static void *pri_dchannel(void *vpri)
pri->pvt[chan]->resetting = 0;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "B-channel %d successfully restarted on span %d\n", chan, pri->span);
- ast_pthread_mutex_unlock(&pri->pvt[chan]->lock);
+ ast_mutex_unlock(&pri->pvt[chan]->lock);
if (pri->resetting)
pri_check_restart(pri);
}
@@ -6031,7 +6031,7 @@ static void *pri_dchannel(void *vpri)
if (option_debug)
ast_log(LOG_DEBUG, "Got event %s (%d) on D-channel for span %d\n", event2str(x), x, pri->span);
}
- pthread_mutex_unlock(&pri->lock);
+ ast_mutex_unlock(&pri->lock);
}
/* Never reached */
return NULL;
@@ -6302,7 +6302,7 @@ static int zap_show_channels(int fd, int argc, char **argv)
if (argc != 3)
return RESULT_SHOWUSAGE;
- ast_pthread_mutex_lock(&iflock);
+ ast_mutex_lock(&iflock);
ast_cli(fd, FORMAT2, "Chan. Num.", "Extension", "Context", "Language", "MusicOnHold");
tmp = iflist;
@@ -6310,7 +6310,7 @@ static int zap_show_channels(int fd, int argc, char **argv)
ast_cli(fd, FORMAT, tmp->channel, tmp->exten, tmp->context, tmp->language, tmp->musicclass);
tmp = tmp->next;
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return RESULT_SUCCESS;
#undef FORMAT
#undef FORMAT2
@@ -6327,7 +6327,7 @@ static int zap_show_channel(int fd, int argc, char **argv)
return RESULT_SHOWUSAGE;
channel = atoi(argv[3]);
- ast_pthread_mutex_lock(&iflock);
+ ast_mutex_lock(&iflock);
tmp = iflist;
while (tmp) {
if (tmp->channel == channel) {
@@ -6392,14 +6392,14 @@ static int zap_show_channel(int fd, int argc, char **argv)
ast_cli(fd, "Actual Confmute: %s\n", x ? "Yes" : "No");
}
#endif
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return RESULT_SUCCESS;
}
tmp = tmp->next;
}
ast_cli(fd, "Unable to find given channel %d\n", channel);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return RESULT_FAILURE;
}
@@ -6457,7 +6457,7 @@ int load_module()
}
- if (ast_pthread_mutex_lock(&iflock)) {
+ if (ast_mutex_lock(&iflock)) {
/* It's a little silly to lock it, but we mind as well just to be sure */
ast_log(LOG_ERROR, "Unable to lock interface list???\n");
return -1;
@@ -6469,7 +6469,7 @@ int load_module()
if (cur_signalling < 0) {
ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
unload_module();
return -1;
}
@@ -6486,7 +6486,7 @@ int load_module()
} else {
ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
unload_module();
return -1;
}
@@ -6504,7 +6504,7 @@ int load_module()
} else {
ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
unload_module();
return -1;
}
@@ -6738,7 +6738,7 @@ int load_module()
else {
ast_log(LOG_ERROR, "Unknown switchtype '%s'\n", v->value);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
unload_module();
return -1;
}
@@ -6755,7 +6755,7 @@ int load_module()
ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
v = v->next;
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
/* Make sure we can register our Zap channel type */
if (ast_channel_register(type, tdesc, AST_FORMAT_SLINEAR | AST_FORMAT_ULAW, zt_request)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
@@ -6814,7 +6814,7 @@ int unload_module()
ast_cli_unregister(&cli_show_channels);
ast_cli_unregister(&cli_show_channel);
ast_cli_unregister(&cli_destroy_channel);
- if (!ast_pthread_mutex_lock(&iflock)) {
+ if (!ast_mutex_lock(&iflock)) {
/* Hangup all interfaces if they have an owner */
p = iflist;
while(p) {
@@ -6823,25 +6823,25 @@ int unload_module()
p = p->next;
}
iflist = NULL;
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
}
- if (!ast_pthread_mutex_lock(&monlock)) {
+ if (!ast_mutex_lock(&monlock)) {
if (monitor_thread) {
pthread_cancel(monitor_thread);
pthread_kill(monitor_thread, SIGURG);
pthread_join(monitor_thread, NULL);
}
monitor_thread = -2;
- ast_pthread_mutex_unlock(&monlock);
+ ast_mutex_unlock(&monlock);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
}
- if (!ast_pthread_mutex_lock(&iflock)) {
+ if (!ast_mutex_lock(&iflock)) {
/* Destroy all the interfaces and free their memory */
p = iflist;
while(p) {
@@ -6857,7 +6857,7 @@ int unload_module()
free(pl);
}
iflist = NULL;
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
@@ -6937,7 +6937,7 @@ static int reload_zt(void)
}
- if (ast_pthread_mutex_lock(&iflock)) {
+ if (ast_mutex_lock(&iflock)) {
/* It's a little silly to lock it, but we mind as well just to be sure */
ast_log(LOG_ERROR, "Unable to lock interface list???\n");
return -1;
@@ -6959,7 +6959,7 @@ static int reload_zt(void)
if (cur_signalling < 0) {
ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return -1;
}
stringp=v->value;
@@ -6973,7 +6973,7 @@ static int reload_zt(void)
} else {
ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return -1;
}
if (finish < start) {
@@ -6990,7 +6990,7 @@ static int reload_zt(void)
} else {
ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return -1;
}
}
@@ -7094,7 +7094,7 @@ static int reload_zt(void)
else {
ast_log(LOG_ERROR, "Unknown switchtype '%s'\n", v->value);
ast_destroy(cfg);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return -1;
}
} else if (!strcasecmp(v->name, "minunused")) {
@@ -7116,7 +7116,7 @@ static int reload_zt(void)
if (tmp->destroy) {
if (destroy_channel(prev, tmp, 0)) {
ast_log(LOG_ERROR, "Unable to destroy chan_zap channel %d\n", tmp->channel);
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
return -1;
}
tmp = tmp->next;
@@ -7126,7 +7126,7 @@ static int reload_zt(void)
}
}
- ast_pthread_mutex_unlock(&iflock);
+ ast_mutex_unlock(&iflock);
ast_destroy(cfg);
#if 0
@@ -7270,9 +7270,9 @@ int reload(void)
int usecount()
{
int res;
- ast_pthread_mutex_lock(&usecnt_lock);
+ ast_mutex_lock(&usecnt_lock);
res = usecnt;
- ast_pthread_mutex_unlock(&usecnt_lock);
+ ast_mutex_unlock(&usecnt_lock);
return res;
}