diff options
author | Christopher Faylor <me@cgf.cx> | 2005-10-01 03:52:13 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-10-01 03:52:13 +0400 |
commit | f5cfdc0fa440eb88870963cc9440369203bb0b13 (patch) | |
tree | 4bbd831c36a65209c3271ed0daabfc1775cbd0f1 /winsup/cygwin | |
parent | fd45a7909b739539a4dd21fa8ce7b284c464124f (diff) |
* dcrt0.cc (do_exit): Don't set ES_SET_MUTO here. Call get_exit_lock()
instead.
(get_exit_lock): New function. Grabs the lock and sets initial exit_state.
* exceptions.cc (try_to_debug): Use low_priority_sleep.
(sigpacket::process): Avoid handler if this is an exec stub.
(signal_exit): Use get_exit_lock rather than manipulating the exit_lock
critical section directly.
* pinfo.cc (pinfo::exit): Ditto.
* winsup.h (get_exit_lock): Declare.
(exit_lock): Delete declaration.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 20 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 12 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 2 |
5 files changed, 38 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a7720f4c2..ce8d7edd2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2005-09-30 Christopher Faylor <cgf@timesys.com> + + * dcrt0.cc (do_exit): Don't set ES_SET_MUTO here. Call get_exit_lock() + instead. + (get_exit_lock): New function. Grabs the lock and sets initial + exit_state. + * exceptions.cc (try_to_debug): Use low_priority_sleep. + (sigpacket::process): Avoid handler if this is an exec stub. + (signal_exit): Use get_exit_lock rather than manipulating the exit_lock + critical section directly. + * pinfo.cc (pinfo::exit): Ditto. + * winsup.h (get_exit_lock): Declare. + (exit_lock): Delete declaration. + 2005-09-30 Corinna Vinschen <corinna@vinschen.de> * fhandler_disk_file.cc: Change calls to pc.set_attributes into diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 953c93ec0..1f88379d1 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -1021,13 +1021,7 @@ do_exit (int status) } #endif - EnterCriticalSection (&exit_lock); - - if (exit_state < ES_SET_MUTO) - { - exit_state = ES_SET_MUTO; - muto::set_exiting_thread (); - } + get_exit_lock (); if (exit_state < ES_GLOBAL_DTORS) { @@ -1144,6 +1138,18 @@ _exit (int n) do_exit (((DWORD) n & 0xff) << 8); } +void +get_exit_lock () +{ + extern CRITICAL_SECTION exit_lock; + EnterCriticalSection (&exit_lock); + if (exit_state < ES_SET_MUTO) + { + exit_state = ES_SET_MUTO; + muto::set_exiting_thread (); + } +} + extern "C" void __api_fatal (const char *fmt, ...) { diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 6811ecf40..02b2f2b49 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -388,7 +388,7 @@ try_to_debug (bool waitloop) return dbg; SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE); while (!being_debugged ()) - Sleep (0); + low_priority_sleep (0); Sleep (2000); } @@ -1041,7 +1041,13 @@ sigpacket::process () myself->rusage_self.ru_nsignals++; bool masked; - void *handler = (void *) thissig.sa_handler; + void *handler; + if (!hExeced || (void *) thissig.sa_handler == (void *) SIG_IGN) + handler = (void *) thissig.sa_handler; + else if (tls) + return 1; + else + handler = NULL; if (si.si_signo == SIGKILL) goto exit_sig; @@ -1175,7 +1181,7 @@ signal_exit (int rc) TerminateProcess (hExeced, sigExeced = rc); } - EnterCriticalSection (&exit_lock); + get_exit_lock (); if (hExeced || exit_state) myself.exit (rc); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 5c2e2f8a8..7e63ef02b 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -140,7 +140,7 @@ pinfo::zap_cwd () void pinfo::exit (DWORD n) { - EnterCriticalSection (&exit_lock); + get_exit_lock (); cygthread::terminate (); if (n != EXITCODE_NOSET) self->exitcode = EXITCODE_SET | n;/* We're really exiting. Record the UNIX exit code. */ diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index f9004e16d..004f5b90b 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -203,6 +203,7 @@ enum exit_states extern exit_states exit_state; void __stdcall do_exit (int) __attribute__ ((regparm (1), noreturn)); +void __stdcall get_exit_lock (); /* UID/GID */ void uinfo_init (); @@ -347,7 +348,6 @@ extern HANDLE hMainProc; extern HANDLE hProcToken; extern HANDLE hProcImpToken; extern HANDLE hExeced; -extern CRITICAL_SECTION exit_lock; extern bool cygwin_testing; |