[Asterisk-cvs] asterisk/channels chan_h323.c,1.31,1.31.2.1 chan_iax.c,1.49,1.49.2.1 chan_iax2.c,1.91.2.8,1.91.2.9 chan_mgcp.c,1.34,1.34.2.1 chan_modem.c,1.19,1.19.2.1 chan_phone.c,1.22,1.22.2.1 chan_sip.c,1.292.2.17,1.292.2.18 chan_skinny.c,1.27,1.27.2.1 chan_vofr.c,1.12,1.12.2.1 chan_zap.c,1.171.2.14,1.171.2.15

citats at lists.digium.com citats at lists.digium.com
Mon Mar 15 02:58:58 CST 2004


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

Modified Files:
      Tag: v1-0_stable
	chan_h323.c chan_iax.c chan_iax2.c chan_mgcp.c chan_modem.c 
	chan_phone.c chan_sip.c chan_skinny.c chan_vofr.c chan_zap.c 
Log Message:
Fix bug 1217.  Change pthread_t initializers to AST_PTHREADT_NULL and
AST_PTHREADT_STOP



Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -u -d -r1.31 -r1.31.2.1
--- chan_h323.c	13 Jan 2004 09:24:26 -0000	1.31
+++ chan_h323.c	15 Mar 2004 07:53:02 -0000	1.31.2.1
@@ -148,7 +148,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -1259,7 +1259,7 @@
 static int restart_monitor(void)
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -1270,7 +1270,7 @@
 		ast_log(LOG_WARNING, "Cannot kill myself\n");
 		return -1;
 	}
-	if (monitor_thread && (monitor_thread != -2)) {
+	if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 		/* Wake up the thread */
 		pthread_kill(monitor_thread, SIGURG);
 	} else {
@@ -1839,12 +1839,12 @@
 	}
 
 	if (!ast_mutex_lock(&monlock)) {
-                if (monitor_thread && (monitor_thread != -2)) {
+                if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
                         pthread_cancel(monitor_thread);
                         pthread_kill(monitor_thread, SIGURG);
                         pthread_join(monitor_thread, NULL);
                  }
-                monitor_thread = (pthread_t) -2;
+                monitor_thread = AST_PTHREADT_STOP;
                 ast_mutex_unlock(&monlock);
         } else {
                 ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -d -r1.49 -r1.49.2.1
--- chan_iax.c	2 Feb 2004 06:38:08 -0000	1.49
+++ chan_iax.c	15 Mar 2004 07:53:02 -0000	1.49.2.1
@@ -149,7 +149,7 @@
 static char accountcode[20];
 static int amaflags = 0;
 
-static pthread_t netthreadid;
+static pthread_t netthreadid = AST_PTHREADT_NULL;
 
 #define IAX_STATE_STARTED		(1 << 0)
 #define IAX_STATE_AUTHENTICATED (1 << 1)
@@ -5344,8 +5344,10 @@
 {
 	int x;
 	/* Cancel the network thread, close the net socket */
-	pthread_cancel(netthreadid);
-	pthread_join(netthreadid, NULL);
+	if (netthreadid != AST_PTHREADT_NULL) {
+		pthread_cancel(netthreadid);
+		pthread_join(netthreadid, NULL);
+	}
 	close(netsocket);
 	for (x=0;x<AST_IAX_MAX_CALLS;x++)
 		if (iaxs[x])

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.91.2.8
retrieving revision 1.91.2.9
diff -u -d -r1.91.2.8 -r1.91.2.9
--- chan_iax2.c	5 Mar 2004 08:58:25 -0000	1.91.2.8
+++ chan_iax2.c	15 Mar 2004 07:53:02 -0000	1.91.2.9
@@ -167,7 +167,7 @@
 static int amaflags = 0;
 static int notransfer = 0;
 
-static pthread_t netthreadid;
+static pthread_t netthreadid = AST_PTHREADT_NULL;
 
 #define IAX_STATE_STARTED		(1 << 0)
 #define IAX_STATE_AUTHENTICATED (1 << 1)
@@ -6147,8 +6147,10 @@
 {
 	int x;
 	/* Cancel the network thread, close the net socket */
-	pthread_cancel(netthreadid);
-	pthread_join(netthreadid, NULL);
+	if (netthreadid != AST_PTHREADT_NULL) {
+		pthread_cancel(netthreadid);
+		pthread_join(netthreadid, NULL);
+	}
 	close(netsocket);
 	for (x=0;x<IAX_MAX_CALLS;x++)
 		if (iaxs[x])

Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.34
retrieving revision 1.34.2.1
diff -u -d -r1.34 -r1.34.2.1
--- chan_mgcp.c	2 Feb 2004 06:38:08 -0000	1.34
+++ chan_mgcp.c	15 Mar 2004 07:53:02 -0000	1.34.2.1
@@ -167,7 +167,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -2558,7 +2558,7 @@
         pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);	
 
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == (pthread_t) -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -3052,12 +3052,12 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread && (monitor_thread != -2)) {
+		if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 			pthread_cancel(monitor_thread);
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_modem.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem.c,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -u -d -r1.19 -r1.19.2.1
--- chan_modem.c	27 Dec 2003 23:46:19 -0000	1.19
+++ chan_modem.c	15 Mar 2004 07:53:02 -0000	1.19.2.1
@@ -83,7 +83,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = (pthread_t) -1;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -646,7 +646,7 @@
 static int restart_monitor()
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == (pthread_t) -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -657,7 +657,7 @@
 		ast_log(LOG_WARNING, "Cannot kill myself\n");
 		return -1;
 	}
-	if (monitor_thread != (pthread_t) -1) {
+	if (monitor_thread != AST_PTHREADT_NULL) {
 		pthread_cancel(monitor_thread);
 		/* Nudge it a little, as it's probably stuck in select */
 		pthread_kill(monitor_thread, SIGURG);
@@ -861,11 +861,11 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread != (pthread_t) -1 && monitor_thread != (pthread_t) -2) {
+		if (monitor_thread != AST_PTHREADT_NULL && monitor_thread != AST_PTHREADT_STOP) {
 			pthread_cancel(monitor_thread);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = (pthread_t) -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_phone.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_phone.c,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -d -r1.22 -r1.22.2.1
--- chan_phone.c	9 Dec 2003 23:55:17 -0000	1.22
+++ chan_phone.c	15 Mar 2004 07:53:02 -0000	1.22.2.1
@@ -67,7 +67,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = -1;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -910,7 +910,7 @@
 static int restart_monitor()
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -921,7 +921,7 @@
 		ast_log(LOG_WARNING, "Cannot kill myself\n");
 		return -1;
 	}
-	if (monitor_thread != -1) {
+	if (monitor_thread != AST_PTHREADT_NULL) {
 		pthread_cancel(monitor_thread);
 #if 0
 		pthread_join(monitor_thread, NULL);
@@ -1071,11 +1071,11 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread > -1) {
+		if (monitor_thread > AST_PTHREADT_NULL) {
 			pthread_cancel(monitor_thread);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.292.2.17
retrieving revision 1.292.2.18
diff -u -d -r1.292.2.17 -r1.292.2.18
--- chan_sip.c	15 Mar 2004 02:07:30 -0000	1.292.2.17
+++ chan_sip.c	15 Mar 2004 07:53:02 -0000	1.292.2.18
@@ -134,7 +134,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -5815,7 +5815,7 @@
 static int restart_monitor(void)
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == (pthread_t) -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -6862,12 +6862,12 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread && ((int)monitor_thread != -2)) {
+		if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 			pthread_cancel(monitor_thread);
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = (pthread_t) -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_skinny.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- chan_skinny.c	2 Feb 2004 06:38:08 -0000	1.27
+++ chan_skinny.c	15 Mar 2004 07:53:02 -0000	1.27.2.1
@@ -599,7 +599,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 /* Wait up to 16 seconds for first digit */
 static int firstdigittimeout = 16000;
@@ -2425,7 +2425,7 @@
 {
 
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == (pthread_t)-2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -2740,12 +2740,12 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread && (monitor_thread != -2)) {
+		if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 			pthread_cancel(monitor_thread);
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_vofr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vofr.c,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -d -r1.12 -r1.12.2.1
--- chan_vofr.c	9 Dec 2003 23:55:17 -0000	1.12
+++ chan_vofr.c	15 Mar 2004 07:53:02 -0000	1.12.2.1
@@ -64,7 +64,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -997,7 +997,7 @@
 static int restart_monitor(void)
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -1161,7 +1161,7 @@
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.171.2.14
retrieving revision 1.171.2.15
diff -u -d -r1.171.2.14 -r1.171.2.15
--- chan_zap.c	12 Mar 2004 21:46:19 -0000	1.171.2.14
+++ chan_zap.c	15 Mar 2004 07:53:02 -0000	1.171.2.15
@@ -225,7 +225,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = 0;
+static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
 
@@ -5157,7 +5157,7 @@
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -7230,12 +7230,12 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread && (monitor_thread != -2)) {
+		if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 			pthread_cancel(monitor_thread);
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = AST_PTHREADT_STOP;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");




More information about the svn-commits mailing list