aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-03 18:25:30 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-03 18:25:30 +0000
commita2fa5b0a02ff9b6aff2143c1424829ee931634b2 (patch)
treec57b8972de82cc3c6440ee7f544526ace4b86acf /apps
parentbe06f432bf5b7dbf84ad2c776e72ea462edb0f0c (diff)
Fix up the device state processing thread in app_queue so that it's not
possible for there to be entries in the queue and the thread is just sleeping (Thanks to mmichelson for bringing the problem to my attention) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@73127 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 85f1b6efe..425f3c64a 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -631,8 +631,10 @@ static void *device_state_thread(void *data)
while (!device_state.stop) {
ast_mutex_lock(&device_state.lock);
- ast_cond_wait(&device_state.cond, &device_state.lock);
- sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry);
+ if (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
+ ast_cond_wait(&device_state.cond, &device_state.lock);
+ sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry);
+ }
ast_mutex_unlock(&device_state.lock);
/* Check to see if we were woken up to see the request to stop */