Fix bug 1217. Change pthread_t initializers to AST_PTHREADT_NULL and

AST_PTHREADT_STOP


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
James Golovich
2004-03-15 07:51:22 +00:00
parent c30ff0935d
commit 0e90480d6b
12 changed files with 52 additions and 48 deletions

View File

@@ -228,7 +228,7 @@ static ast_mutex_t monlock = AST_MUTEX_INITIALIZER;
/* This is the thread for the monitor which checks for input on the channels
which are not currently in use. */
static pthread_t monitor_thread = 0;
static pthread_t monitor_thread = AST_PTHREADT_NULL;
static int restart_monitor(void);
@@ -5171,7 +5171,7 @@ static int restart_monitor(void)
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == -2)
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
if (ast_mutex_lock(&monlock)) {
ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -7313,12 +7313,12 @@ static int __unload_module(void)
return -1;
}
if (!ast_mutex_lock(&monlock)) {
if (monitor_thread && (monitor_thread != -2)) {
if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
pthread_cancel(monitor_thread);
pthread_kill(monitor_thread, SIGURG);
pthread_join(monitor_thread, NULL);
}
monitor_thread = -2;
monitor_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&monlock);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");