From 5160c5f4303773e03d599342e696fa3c349f9f05 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 24 Oct 2010 18:50:57 +0000 Subject: * dcrt0.cc (do_exit): Don't set thread termination until all fds have been closed since an fd may rely on a thread. * fhandler_tty.cc: Reformat comment. (fhandler_pty_master::pty_master_thread): Refuse ERROR_PIPE_CONNECTED state as an error. * globals.cc (exit_states): Reorder ES_THREADTERM. * path.cc (find_fast_cwd_pointers): Remove excessively wordy DEBUGGING output. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/dcrt0.cc | 14 +++++++------- winsup/cygwin/fhandler_tty.cc | 9 ++++----- winsup/cygwin/globals.cc | 2 +- winsup/cygwin/path.cc | 3 --- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 554d14fd6..42b1a8853 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2010-10-24 Christopher Faylor + + * dcrt0.cc (do_exit): Don't set thread termination until all fds have + been closed since an fd may rely on a thread. + * fhandler_tty.cc: Reformat comment. + (fhandler_pty_master::pty_master_thread): Refuse ERROR_PIPE_CONNECTED + state as an error. + * globals.cc (exit_states): Reorder ES_THREADTERM. + + * path.cc (find_fast_cwd_pointers): Remove excessively wordy DEBUGGING output. + 2010-10-24 Christopher Faylor * exceptions.cc (try_to_debug): Improve comment. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 13dc33d17..4aca47495 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -1054,13 +1054,6 @@ do_exit (int status) events_terminate (); } - UINT n = (UINT) status; - if (exit_state < ES_THREADTERM) - { - exit_state = ES_THREADTERM; - cygthread::terminate (); - } - if (exit_state < ES_SIGNAL) { exit_state = ES_SIGNAL; @@ -1076,6 +1069,13 @@ do_exit (int status) close_all_files (); } + UINT n = (UINT) status; + if (exit_state < ES_THREADTERM) + { + exit_state = ES_THREADTERM; + cygthread::terminate (); + } + myself->stopsig = 0; if (exit_state < ES_HUP_PGRP) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 56ef28020..4ef3457e8 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1614,10 +1614,9 @@ extern "C" BOOL WINAPI GetNamedPipeClientProcessId (HANDLE, PULONG); OSes there's no function to check for the PID of the client process so we have to trust the client side. - Since there's - always only one pipe instance, there's a chance that clients have to - wait to connect to the master control pipe. Therefore the client calls - to CallNamedPipe should have a big enough timeout value. For now this + Since there's always only one pipe instance, there's a chance that clients + have to wait to connect to the master control pipe. Therefore the client + calls to CallNamedPipe should have a big enough timeout value. For now this is 500ms. Hope that's enough. */ DWORD @@ -1635,7 +1634,7 @@ fhandler_pty_master::pty_master_thread () DWORD pid; termios_printf ("Entered"); - while (!exit && ConnectNamedPipe (master_ctl, NULL)) + while (!exit && (ConnectNamedPipe (master_ctl, NULL) || GetLastError () == ERROR_PIPE_CONNECTED)) { pipe_reply repl = { NULL, NULL, 0 }; bool deimp = false; diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index 811192de2..801ae742d 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -35,9 +35,9 @@ enum exit_states ES_EXIT_STARTING, ES_PROCESS_LOCKED, ES_EVENTS_TERMINATE, - ES_THREADTERM, ES_SIGNAL, ES_CLOSEALL, + ES_THREADTERM, ES_HUP_PGRP, ES_HUP_SID, ES_EXEC_EXIT, diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 468570166..ebd613e4a 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3477,9 +3477,6 @@ find_fast_cwd_pointers () if (movesi[0] != 0x8b) return; fast_cwd_ptr = (PFAST_CWD *) peek32 (movesi + 2); -#ifdef DEBUGGING - system_printf ("fast_cwd_ptr: %p", fast_cwd_ptr); -#endif } static inline void -- cgit v1.2.3