[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.32,1.33

markster at lists.digium.com markster at lists.digium.com
Sun Feb 1 18:38:17 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv16553/channels

Modified Files:
	chan_mgcp.c 
Log Message:
Use better flags when starting MGCP threads (bug #598)


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- chan_mgcp.c	12 Jan 2004 17:32:19 -0000	1.32
+++ chan_mgcp.c	2 Feb 2004 00:46:59 -0000	1.33
@@ -2069,6 +2069,9 @@
     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) {
@@ -2113,7 +2116,7 @@
                 }
                 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);
                     }
@@ -2548,6 +2551,10 @@
 
 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;
@@ -2565,7 +2572,7 @@
 		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;




More information about the svn-commits mailing list