From 0428827b0ef30a187a72fc0fc5352d7c0c170c82 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 18 Aug 2002 04:13:57 +0000 Subject: * sigproc.cc (sigCONT): Define. * sigproc.h (sigCONT): Declare. (wait_sig): Create sigCONT event here. * exceptions.cc (sig_handle_tty_stop): Wait for sigCONT event rather than stopping thread. (sig_handle): Set sigCONT event as appropriate on SIGCONT rather than calling ResumeThread. --- winsup/cygwin/exceptions.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 914e4424d..cadd6baaf 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -615,7 +615,9 @@ sig_handle_tty_stop (int sig) } sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p", myself->pid, sig, myself->ppid_handle); - SuspendThread (hMainThread); + if (WaitForSingleObject (sigCONT, INFINITE) != WAIT_OBJECT_0) + api_fatal ("WaitSingleObject failed, %E"); + (void) ResetEvent (sigCONT); return; } } @@ -992,6 +994,7 @@ sig_handle (int sig, bool thisproc) /* FIXME: Should we still do this if SIGCONT has a handler? */ if (sig == SIGCONT) { + DWORD stopped = myself->process_state & PID_STOPPED; myself->stopsig = 0; myself->process_state &= ~PID_STOPPED; /* Clear pending stop signals */ @@ -999,10 +1002,8 @@ sig_handle (int sig, bool thisproc) sig_clear (SIGTSTP); sig_clear (SIGTTIN); sig_clear (SIGTTOU); - /* Windows 95 hangs on resuming non-suspended thread */ - SuspendThread (hMainThread); - while (ResumeThread (hMainThread) > 1) - ; + if (stopped) + SetEvent (sigCONT); /* process pending signals */ sig_dispatch_pending (1); } -- cgit v1.2.3