From 0449baca5935e8e05c4db205541719258e9f789e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Apr 2014 03:23:13 +0500 Subject: [PATCH] clear event queue on shutdown --- src/switch_scheduler.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c index a14c91e432..55875722bd 100644 --- a/src/switch_scheduler.c +++ b/src/switch_scheduler.c @@ -194,6 +194,12 @@ static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t *th task_thread_loop(1); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Task thread ending\n"); + + while(switch_queue_trypop(globals.event_queue, &pop) == SWITCH_STATUS_SUCCESS) { + switch_event_t *event = (switch_event_t *) pop; + switch_event_destroy(&event); + } + globals.task_thread_running = 0; return NULL;