From: Brett Bryant Date: Mon, 18 Jun 2007 22:23:51 +0000 (+0000) Subject: Fixed issue where 'stop gracfeully' was hanging ... X-Git-Tag: 1.6.0-beta1~3^2~2343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7573042f954910b92fc3a2c033a72d580c8f02a2;p=thirdparty%2Fasterisk.git Fixed issue where 'stop gracfeully' was hanging ... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69807 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index fb919f1072..06e9a913c8 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -628,14 +628,17 @@ static void *device_state_thread(void *data) while (!device_state.stop) { ast_mutex_lock(&device_state.lock); - while (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) - ast_cond_wait(&device_state.cond, &device_state.lock); + 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 */ if (device_state.stop) return NULL; + if (!sc) + continue; + handle_statechange(sc); free(sc);