diff options
author | Christopher Faylor <me@cgf.cx> | 2005-09-23 23:37:52 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-09-23 23:37:52 +0000 |
commit | 5e477e9a9b0bf9597f8f9a829edfe554ee97b140 (patch) | |
tree | 3de620f8769d15f51065ea593c5b12381bcf3714 /winsup/cygwin/sigproc.cc | |
parent | 1b19d7429605f4879186aa3eb0214e2c22bc4530 (diff) | |
download | cygnal-5e477e9a9b0bf9597f8f9a829edfe554ee97b140.tar.gz cygnal-5e477e9a9b0bf9597f8f9a829edfe554ee97b140.tar.bz2 cygnal-5e477e9a9b0bf9597f8f9a829edfe554ee97b140.zip |
Semi-reversion of always-exit-from-sigthread change of 2005-09-15.
* exceptions.cc (sigpacket::process): Eliminate return after call to reinstated
noreturn function.
(signal_exit): Allow function to exit when a captive process has been
terminated.
* pinfo.cc (pinfo::exit): Enter exit_lock here. Once again exit here under
control of exit_lock.
* sigproc.cc (sig_send): Don't wait for completion if process is exiting.
Remove special __SIGEXIT accommodations.
(wait_sig): Just exit the thread when a __SIGEXIT has been detected. Don't
exit the process.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 6bcb6bce9..69c9bce20 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -553,7 +553,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) } if (wait_sig_inited) wait_for_sigthread (); - wait_for_completion = p != myself_nowait && _my_tls.isinitialized (); + wait_for_completion = p != myself_nowait && _my_tls.isinitialized () && !exit_state; p = myself; } @@ -621,15 +621,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) pack.si.si_uid = myself->uid; pack.pid = myself->pid; pack.tls = (_cygtls *) tls; - if (si.si_signo == __SIGEXIT) - { - if (&_my_tls == _main_tls) - pack.thread_handle = hMainThread; - else - DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc, &pack.thread_handle, 0, - FALSE, DUPLICATE_SAME_ACCESS); - } - else if (wait_for_completion) + if (wait_for_completion) { pack.wakeup = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL); sigproc_printf ("wakeup %p", pack.wakeup); @@ -1122,29 +1114,6 @@ wait_sig (VOID *self) break; } - my_sendsig = NULL; - HANDLE& h = pack.thread_handle; - if (!h) - api_fatal ("no thread handle set on exit"); - DWORD res = WaitForSingleObject (h, INFINITE); - - DWORD exitcode = 1; - - myself.release (); - if (res == WAIT_OBJECT_0) - { - GetExitCodeThread (h, &exitcode); -#ifdef DEBUGGING - hMainThread = INVALID_HANDLE_VALUE; -#endif - } else { -#ifdef DEBUGGING - console_printf ("wait for main thread %p returned %d", h, res); -#else - debug_printf ("wait for main thread %p returned %d", h, res); -#endif - } - - sigproc_printf ("calling ExitProcess, exitcode %p", exitcode); - ExitProcess (exitcode); + sigproc_printf ("signal thread exiting"); + ExitThread (0); } |