[Asterisk-cvs] asterisk asterisk.c,1.51.2.3,1.51.2.4

citats at lists.digium.com citats at lists.digium.com
Tue Mar 2 18:59:38 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/home/citats/cvs/asterisk-stable

Modified Files:
      Tag: v1-0_stable
	asterisk.c 
Log Message:
Improve restart handling



Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.51.2.3
retrieving revision 1.51.2.4
diff -u -d -r1.51.2.3 -r1.51.2.4
--- asterisk.c	2 Mar 2004 23:37:09 -0000	1.51.2.3
+++ asterisk.c	2 Mar 2004 23:50:14 -0000	1.51.2.4
@@ -543,9 +543,11 @@
 		restartnow = 1;
 		/* If there is a consolethread running send it a SIGHUP 
 		   so it can execvp, otherwise we can do it ourselves */
-		if (consolethread != (pthread_t) -1)
+		if (consolethread != (pthread_t) -1) {
 			pthread_kill(consolethread, SIGHUP);
-		else
+			/* Give the signal handler some time to complete */
+			sleep(2);
+		} else
 			execvp(_argv[0], _argv);
 	
 	}
@@ -1471,6 +1473,8 @@
 		ast_verbose(" ]\n");
 	if (option_verbose || option_console)
 		ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
+	if (option_nofork)
+		consolethread = pthread_self();
 	fully_booted = 1;
 	pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
 #ifdef __AST_DEBUG_MALLOC
@@ -1485,8 +1489,6 @@
 	ast_cli_register(&astshutdownwhenconvenient);
 	ast_cli_register(&aborthalt);
 	ast_cli_register(&astbang);
-	if (option_nofork)
-		consolethread = pthread_self();
 	if (option_console) {
 		/* Console stuff now... */
 		/* Register our quit function */




More information about the svn-commits mailing list