From 1c300a3c515c11a7bee074f291d2eaf616a374c4 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Sat, 17 Dec 2011 02:55:44 +0000 Subject: [PATCH] mod_posix_timer -mutex fixes --- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 80acfa5864..97002a86c7 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -68,13 +68,13 @@ static void posix_timer_notify(sigval_t data) switch_mutex_unlock(it->mutex); if (globals.shutdown) { - switch_mutex_lock(it->mutex); + switch_mutex_lock(globals.interval_timers_mutex); if (it->users) { timer_delete(it->timer); memset(&it->timer, 0, sizeof(it->timer)); it->users = 0; } - switch_mutex_unlock(it->mutex); + switch_mutex_unlock(globals.interval_timers_mutex); } } @@ -133,8 +133,10 @@ static switch_status_t posix_timer_stop_interval(interval_timer_t *it) if (it->users > 0) { it->users--; if (it->users == 0) { + switch_mutex_lock(it->mutex); timer_delete(it->timer); memset(&it->timer, 0, sizeof(it->timer)); + switch_mutex_unlock(it->mutex); } } return SWITCH_STATUS_SUCCESS;