[asterisk-commits] file: branch 1.4 r74045 - in /branches/1.4: channels/ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 9 09:49:05 CDT 2007


Author: file
Date: Mon Jul  9 09:49:05 2007
New Revision: 74045

URL: http://svn.digium.com/view/asterisk?view=rev&rev=74045
Log:
Few minor thread synchronization tweaks. (issue #10124 reported by gzero)

Modified:
    branches/1.4/channels/chan_skinny.c
    branches/1.4/pbx/pbx_dundi.c

Modified: branches/1.4/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_skinny.c?view=diff&rev=74045&r1=74044&r2=74045
==============================================================================
--- branches/1.4/channels/chan_skinny.c (original)
+++ branches/1.4/channels/chan_skinny.c Mon Jul  9 09:49:05 2007
@@ -4778,7 +4778,7 @@
 	delete_devices();
 
 	ast_mutex_lock(&monlock);
-	if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
+	if ((monitor_thread != AST_PTHREADT_NULL) && (monitor_thread != AST_PTHREADT_STOP)) {
 		pthread_cancel(monitor_thread);
 		pthread_kill(monitor_thread, SIGURG);
 		pthread_join(monitor_thread, NULL);

Modified: branches/1.4/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_dundi.c?view=diff&rev=74045&r1=74044&r2=74045
==============================================================================
--- branches/1.4/pbx/pbx_dundi.c (original)
+++ branches/1.4/pbx/pbx_dundi.c Mon Jul  9 09:49:05 2007
@@ -2093,6 +2093,9 @@
 		}
 		check_password();
 	}
+
+	netthreadid = AST_PTHREADT_NULL;
+	
 	return NULL;
 }
 
@@ -2127,6 +2130,8 @@
 		} else
 			sleep(1);
 	}
+
+	precachethreadid = AST_PTHREADT_NULL;
 
 	return NULL;
 }
@@ -4467,10 +4472,14 @@
 
 	/* Stop all currently running threads */
 	dundi_shutdown = 1;
-	pthread_kill(netthreadid, SIGURG);
-	pthread_join(netthreadid, NULL);
-	pthread_kill(precachethreadid, SIGURG);
-	pthread_join(precachethreadid, NULL);
+	if (netthreadid != AST_PTHREADT_NULL) {
+		pthread_kill(netthreadid, SIGURG);
+		pthread_join(netthreadid, NULL);
+	}
+	if (precachethreadid != AST_PTHREADT_NULL) {
+		pthread_kill(precachethreadid, SIGURG);
+		pthread_join(precachethreadid, NULL);
+	}
 
 	ast_cli_unregister_multiple(cli_dundi, sizeof(cli_dundi) / sizeof(struct ast_cli_entry));
 	ast_unregister_switch(&dundi_switch);




More information about the asterisk-commits mailing list