diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-19 16:50:52 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-19 16:50:52 +0000 |
commit | 64304ad25d7ebd087c39b44c4c1dffcb983d6fc5 (patch) | |
tree | 4595f6ef8ba463ba0812b3c2aacad1f7c377402a | |
parent | 49889153a8a9cbcc0f4673a83c0f0ed376123e23 (diff) |
Use the right pthread lock and condition when waiting.
(closes issue #12664)
Reported by: tomo1657
Patches:
res_smdi.c.patch uploaded by tomo1657 (license 484)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@117135 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | res/res_smdi.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/res/res_smdi.c b/res/res_smdi.c index 9315cf973..b6a0b4593 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -394,6 +394,19 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout, struct timeval start; long diff = 0; void *msg; + ast_cond_t *cond = NULL; + ast_mutex_t *lock = NULL; + + switch (type) { + case SMDI_MWI: + cond = &iface->mwi_q_cond; + lock = &iface->mwi_q_lock; + break; + case SMDI_MD: + cond = &iface->md_q_cond; + lock = &iface->md_q_lock; + break; + } start = ast_tvnow(); while (diff < timeout) { @@ -414,7 +427,7 @@ static void *smdi_message_wait(struct ast_smdi_interface *iface, int timeout, /* If there were no messages in the queue, then go to sleep until one * arrives. */ - ast_cond_timedwait(&iface->md_q_cond, &iface->md_q_lock, &ts); + ast_cond_timedwait(cond, lock, &ts); if ((msg = smdi_msg_find(iface, type, station))) { unlock_msg_q(iface, type); |