aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_smdi.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-19 16:53:33 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-19 16:53:33 +0000
commit49884f46f0bc9b67f3c871d8a11145ee5a39e9a2 (patch)
treeadd553f88b83be12b04b4cd51791d32188c542f1 /res/res_smdi.c
parent65117da50c17bed50607eb8709761c8f4c1c7b76 (diff)
Merged revisions 117135 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r117135 | file | 2008-05-19 13:50:52 -0300 (Mon, 19 May 2008) | 6 lines 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/trunk@117136 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_smdi.c')
-rw-r--r--res/res_smdi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 97b58b5db..9bcccab49 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -419,6 +419,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();
@@ -440,7 +453,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, search_key, options))) {
unlock_msg_q(iface, type);