[asterisk-commits] branch 1.2 r36751 - /branches/1.2/asterisk.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Jul 2 22:12:04 MST 2006


Author: russell
Date: Mon Jul  3 00:12:03 2006
New Revision: 36751

URL: http://svn.digium.com/view/asterisk?rev=36751&view=rev
Log:
fix a race condition that caused asterisk to log a *ton* of warnings on mac
osx about poll returning an error because the polled file descriptor was bad.

Modified:
    branches/1.2/asterisk.c

Modified: branches/1.2/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/asterisk.c?rev=36751&r1=36750&r2=36751&view=diff
==============================================================================
--- branches/1.2/asterisk.c (original)
+++ branches/1.2/asterisk.c Mon Jul  3 00:12:03 2006
@@ -592,6 +592,7 @@
 		fds[0].fd = ast_socket;
 		fds[0].events= POLLIN;
 		s = poll(fds, 1, -1);
+		pthread_testcancel();
 		if (s < 0) {
 			if (errno != EINTR)
 				ast_log(LOG_WARNING, "poll returned error: %s\n", strerror(errno));
@@ -905,13 +906,13 @@
 		ast_log(LOG_DEBUG, "Asterisk ending (%d).\n", num);
 	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\nRestart: %s\r\n", ast_active_channels() ? "Uncleanly" : "Cleanly", restart ? "True" : "False");
 	if (ast_socket > -1) {
+		pthread_cancel(lthread);
 		close(ast_socket);
 		ast_socket = -1;
+		unlink(ast_config_AST_SOCKET);
 	}
 	if (ast_consock > -1)
 		close(ast_consock);
-	if (ast_socket > -1)
-		unlink((char *)ast_config_AST_SOCKET);
 	if (!option_remote) unlink((char *)ast_config_AST_PID);
 	printf(term_quit());
 	if (restart) {



More information about the asterisk-commits mailing list