mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 06:48:25 +00:00
Use better flags when starting MGCP threads (bug #598)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2069,6 +2069,9 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev)
|
|||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
struct ast_channel *c;
|
struct ast_channel *c;
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
|
pthread_attr_t attr;
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
|
|
||||||
/* Off hook / answer */
|
/* Off hook / answer */
|
||||||
if (sub->outgoing) {
|
if (sub->outgoing) {
|
||||||
@@ -2113,7 +2116,7 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev)
|
|||||||
}
|
}
|
||||||
c = mgcp_new(sub, AST_STATE_DOWN);
|
c = mgcp_new(sub, AST_STATE_DOWN);
|
||||||
if (c) {
|
if (c) {
|
||||||
if (pthread_create(&t, NULL, mgcp_ss, c)) {
|
if (pthread_create(&t, &attr, mgcp_ss, c)) {
|
||||||
ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
|
||||||
ast_hangup(c);
|
ast_hangup(c);
|
||||||
}
|
}
|
||||||
@@ -2548,6 +2551,10 @@ 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 == (pthread_t) -2)
|
if (monitor_thread == (pthread_t) -2)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2565,7 +2572,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 (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
|
if (pthread_create(&monitor_thread, &attr, 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user