Merged revisions 9404 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r9404 | kpfleming | 2006-02-10 14:38:59 -0600 (Fri, 10 Feb 2006) | 2 lines don't create monitor threads in detached mode, when we need to be able to pthread_join() them later if the module is unloaded (solve crash-on-unload problem for these channel modules) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
b40bd71a9a
commit
cadfcdfe8e
4
cdr.c
4
cdr.c
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
|
@ -1181,8 +1181,6 @@ static int do_reload(void)
|
||||||
if it does not exist */
|
if it does not exist */
|
||||||
if (enabled && batchmode && (!was_enabled || !was_batchmode) && (cdr_thread == AST_PTHREADT_NULL)) {
|
if (enabled && batchmode && (!was_enabled || !was_batchmode) && (cdr_thread == AST_PTHREADT_NULL)) {
|
||||||
ast_cond_init(&cdr_pending_cond, NULL);
|
ast_cond_init(&cdr_pending_cond, NULL);
|
||||||
pthread_attr_init(&attr);
|
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
|
||||||
if (ast_pthread_create(&cdr_thread, &attr, do_cdr, NULL) < 0) {
|
if (ast_pthread_create(&cdr_thread, &attr, do_cdr, NULL) < 0) {
|
||||||
ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
|
ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
|
||||||
ast_sched_del(sched, cdr_sched);
|
ast_sched_del(sched, cdr_sched);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
|
@ -3528,10 +3528,6 @@ static void *do_monitor(void *data)
|
||||||
|
|
||||||
static int restart_monitor(void)
|
static int restart_monitor(void)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
|
||||||
pthread_attr_init(&attr);
|
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
|
||||||
|
|
||||||
/* If we're supposed to be stopped -- stay stopped */
|
/* If we're supposed to be stopped -- stay stopped */
|
||||||
if (monitor_thread == AST_PTHREADT_STOP)
|
if (monitor_thread == AST_PTHREADT_STOP)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3549,7 +3545,7 @@ static int restart_monitor(void)
|
||||||
pthread_kill(monitor_thread, SIGURG);
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
} else {
|
} else {
|
||||||
/* Start a new monitor */
|
/* Start a new monitor */
|
||||||
if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
|
if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
|
||||||
ast_mutex_unlock(&monlock);
|
ast_mutex_unlock(&monlock);
|
||||||
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
|
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -11464,8 +11464,6 @@ static int restart_monitor(void)
|
||||||
/* Wake up the thread */
|
/* Wake up the thread */
|
||||||
pthread_kill(monitor_thread, SIGURG);
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
} else {
|
} else {
|
||||||
pthread_attr_init(&attr);
|
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
|
||||||
/* Start a new monitor */
|
/* Start a new monitor */
|
||||||
if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
|
if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
|
||||||
ast_mutex_unlock(&monlock);
|
ast_mutex_unlock(&monlock);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
|
@ -265,12 +265,8 @@ static void *do_devstate_changes(void *data)
|
||||||
/*! \brief Initialize the device state engine in separate thread */
|
/*! \brief Initialize the device state engine in separate thread */
|
||||||
int ast_device_state_engine_init(void)
|
int ast_device_state_engine_init(void)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
|
||||||
|
|
||||||
ast_cond_init(&change_pending, NULL);
|
ast_cond_init(&change_pending, NULL);
|
||||||
pthread_attr_init(&attr);
|
if (ast_pthread_create(&change_thread, NULL, do_devstate_changes, NULL) < 0) {
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
|
||||||
if (ast_pthread_create(&change_thread, &attr, do_devstate_changes, NULL) < 0) {
|
|
||||||
ast_log(LOG_ERROR, "Unable to start device state change thread.\n");
|
ast_log(LOG_ERROR, "Unable to start device state change thread.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
6
dnsmgr.c
6
dnsmgr.c
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005, Kevin P. Fleming
|
* Copyright (C) 2005-2006, Kevin P. Fleming
|
||||||
*
|
*
|
||||||
* Kevin P. Fleming <kpfleming@digium.com>
|
* Kevin P. Fleming <kpfleming@digium.com>
|
||||||
*
|
*
|
||||||
|
@ -338,9 +338,7 @@ static int do_reload(int loading)
|
||||||
/* if this reload enabled the manager, create the background thread
|
/* if this reload enabled the manager, create the background thread
|
||||||
if it does not exist */
|
if it does not exist */
|
||||||
if (enabled && !was_enabled && (refresh_thread == AST_PTHREADT_NULL)) {
|
if (enabled && !was_enabled && (refresh_thread == AST_PTHREADT_NULL)) {
|
||||||
pthread_attr_init(&attr);
|
if (ast_pthread_create(&refresh_thread, NULL, do_refresh, NULL) < 0) {
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
|
||||||
if (ast_pthread_create(&refresh_thread, &attr, do_refresh, NULL) < 0) {
|
|
||||||
ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
|
ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue