struct mgcp_endpoint *p = sub->parent;
struct ast_channel *c;
pthread_t t;
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
/* Off hook / answer */
if (sub->outgoing) {
}
c = mgcp_new(sub, AST_STATE_DOWN);
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_hangup(c);
}
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 (monitor_thread == (pthread_t) -2)
return 0;
pthread_kill(monitor_thread, SIGURG);
} else {
/* 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_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;