diff options
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-03 02:04:22 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-03 02:04:22 +0000
commit52c47ccd84918a2435e402b3de187f268d0cea49 (patch)
parenteae2f2ddaf1d2f597d2f4c2ee4a341376132b0c0 (diff)
Don't reuse the timespec that was set to 0 in the previous timedwait as it
will just return immediately. Also, fix some logic so the thread's lock isn't unlocked twice in the weird case of dynamic threads getting acquired right after a timeout. (pointed out by SteveK) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@78028 f38db490-d61c-443f-a65b-d21fe96a405b
1 files changed, 2 insertions, 5 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5cc34ee77..d44fb0420 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -7895,15 +7895,12 @@ static void *iax2_process_thread(void *data)
/* Someone grabbed our thread *right* after we timed out.
* Wait for them to set us up with something to do and signal
* us to continue. */
- ast_cond_timedwait(&thread->cond, &thread->lock, &ts);
- ast_mutex_unlock(&thread->lock);
+ ast_cond_wait(&thread->cond, &thread->lock);
- if (!t)
- ast_mutex_unlock(&thread->lock);
} else {
ast_cond_wait(&thread->cond, &thread->lock);
- ast_mutex_unlock(&thread->lock);
+ ast_mutex_unlock(&thread->lock);
/* Add ourselves to the active list now */