Merged revisions 104536 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Wed, 27 Feb 2008 15:58:28 +0000 (15:58 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 27 Feb 2008 15:58:28 +0000 (15:58 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104536 | file | 2008-02-27 11:52:02 -0400 (Wed, 27 Feb 2008) | 4 lines

Only stop the MWI monitor thread if it was actually started.
(closes issue #12086)
Reported by: francesco_r

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104537 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_smdi.c

index 3a8a5f4..bd3170e 100644 (file)
@@ -1274,7 +1274,9 @@ static int unload_module(void)
        ast_cond_signal(&mwi_monitor.cond);
        ast_mutex_unlock(&mwi_monitor.lock);
 
-       pthread_join(mwi_monitor.thread, NULL);
+       if (mwi_monitor.thread != AST_PTHREADT_NULL) {
+               pthread_join(mwi_monitor.thread, NULL);
+       }
 
        ast_custom_function_unregister(&smdi_msg_retrieve_function);
        ast_custom_function_unregister(&smdi_msg_function);