[asterisk-commits] kpfleming: trunk r49637 - in /trunk: ./ channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 5 10:10:59 MST 2007


Author: kpfleming
Date: Fri Jan  5 11:10:59 2007
New Revision: 49637

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49637
Log:
Merged revisions 49636 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r49636 | kpfleming | 2007-01-05 11:09:00 -0600 (Fri, 05 Jan 2007) | 10 lines

Merged revisions 49635 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r49635 | kpfleming | 2007-01-05 10:56:40 -0600 (Fri, 05 Jan 2007) | 2 lines

ensure that threads which are supposed to be detached (because we aren't going to wait on them) are created properly

........

................

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=49637&r1=49636&r2=49637
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri Jan  5 11:10:59 2007
@@ -6134,16 +6134,20 @@
 {
 	pthread_t newthread;
 	struct dpreq_data *dpr;
+	pthread_attr_t attr;
 	
 	if (!(dpr = ast_calloc(1, sizeof(*dpr))))
 		return;
+
+	pthread_attr_init(&attr);
+	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);	
 
 	dpr->callno = callno;
 	ast_copy_string(dpr->context, context, sizeof(dpr->context));
 	ast_copy_string(dpr->callednum, callednum, sizeof(dpr->callednum));
 	if (callerid)
 		dpr->callerid = ast_strdup(callerid);
-	if (ast_pthread_create(&newthread, NULL, dp_lookup_thread, dpr)) {
+	if (ast_pthread_create(&newthread, &attr, dp_lookup_thread, dpr)) {
 		ast_log(LOG_WARNING, "Unable to start lookup thread!\n");
 	}
 }
@@ -6213,9 +6217,14 @@
 		return -1;
 	}
 	if ((d = ast_calloc(1, sizeof(*d)))) {
+		pthread_attr_t attr;
+
+		pthread_attr_init(&attr);
+		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
 		d->chan1 = chan1m;
 		d->chan2 = chan2m;
-		if (!ast_pthread_create_background(&th, NULL, iax_park_thread, d))
+		if (!ast_pthread_create_background(&th, &attr, iax_park_thread, d))
 			return 0;
 		free(d);
 	}

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=49637&r1=49636&r2=49637
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Jan  5 11:10:59 2007
@@ -12751,12 +12751,17 @@
 		return -1;
 	}
 	if ((d = ast_calloc(1, sizeof(*d)))) {
+		pthread_attr_t attr;
+
+		pthread_attr_init(&attr);
+		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);	
+
 		/* Save original request for followup */
 		copy_request(&d->req, req);
 		d->chan1 = transferee;	/* Transferee */
 		d->chan2 = transferer;	/* Transferer */
 		d->seqno = seqno;
-		if (ast_pthread_create_background(&th, NULL, sip_park_thread, d) < 0) {
+		if (ast_pthread_create_background(&th, &attr, sip_park_thread, d) < 0) {
 			/* Could not start thread */
 			free(d);	/* We don't need it anymore. If thread is created, d will be free'd
 					   by sip_park_thread() */

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=49637&r1=49636&r2=49637
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Fri Jan  5 11:10:59 2007
@@ -749,7 +749,6 @@
 struct ast_hostent ahp;
 struct hostent *hp;
 static int skinnysock = -1;
-static pthread_t tcp_thread;
 static pthread_t accept_t;
 static char context[AST_MAX_CONTEXT] = "default";
 static char language[MAX_LANGUAGE] = "";
@@ -4271,6 +4270,7 @@
 	struct protoent *p;
 	int arg = 1;
 	pthread_attr_t attr;
+	pthread_t tcp_thread;
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -4299,7 +4299,7 @@
 		sessions = s;
 		ast_mutex_unlock(&sessionlock);
 
-		if (ast_pthread_create(&tcp_thread, NULL, skinny_session, s)) {
+		if (ast_pthread_create(&tcp_thread, &attr, skinny_session, s)) {
 			destroy_session(s);
 		}
 	}
@@ -4678,13 +4678,6 @@
 	monitor_thread = AST_PTHREADT_STOP;
 	ast_mutex_unlock(&monlock);
 
-	if (tcp_thread && (tcp_thread != AST_PTHREADT_STOP)) {
-		pthread_cancel(tcp_thread);
-		pthread_kill(tcp_thread, SIGURG);
-		pthread_join(tcp_thread, NULL);
-	}
-	tcp_thread = AST_PTHREADT_STOP;
-
 	ast_mutex_lock(&netlock);
 	if (accept_t && (accept_t != AST_PTHREADT_STOP)) {
 		pthread_cancel(accept_t);



More information about the asterisk-commits mailing list