From 4b3a3fb14c298512ef69e17a710e210de14914fb Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 24 May 2007 18:30:19 +0000 Subject: Add a new API call for creating detached threads. Then, go replace all of the places in the code where the same block of code for creating detached threads was replicated. (patch from bbryant) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65968 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_mgcp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'channels/chan_mgcp.c') diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index f9caf584d..3895330c5 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -2956,9 +2956,6 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev) 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) { @@ -3006,7 +3003,7 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev) } c = mgcp_new(sub, AST_STATE_DOWN); if (c) { - if (ast_pthread_create(&t, &attr, mgcp_ss, c)) { + if (ast_pthread_create_detached(&t, NULL, mgcp_ss, c)) { ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno)); ast_hangup(c); } @@ -3034,7 +3031,6 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev) /*ast_queue_control(sub->owner, AST_CONTROL_ANSWER);*/ } } - pthread_attr_destroy(&attr); } static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, struct sockaddr_in *sin) -- cgit v1.2.3