From 6267956bdaf16b9428503c6a4dbef07eab93105e Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Mon, 17 Dec 2007 13:34:03 +0000 Subject: Make chan_unistim actually be able to unload. When creating a thread that you want to pthread_join you have to explicitly create it as joinable, and also if using pthread_cancel you have to have a pthread_testcancel to see if it has been called. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93187 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_unistim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index d4cb0f347..a6742b5f4 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -4591,6 +4591,7 @@ static void *do_monitor(void *data) ast_verbose(VERBOSE_PREFIX_1 "Reloading unistim.conf...\n"); reload_config(); } + pthread_testcancel(); } /* Never reached */ return NULL; @@ -4617,7 +4618,7 @@ static int restart_monitor(void) pthread_kill(monitor_thread, SIGURG); } else { pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); /* Start a new monitor */ if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) { ast_mutex_unlock(&monlock); -- cgit v1.2.3