* 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.
This commit is contained in:
Christopher Faylor 2002-08-18 04:13:57 +00:00
parent a80add95d9
commit 0428827b0e
5 changed files with 32 additions and 16 deletions

View File

@ -1,8 +1,18 @@
2002-08-18 Christopher Faylor <cgf@redhat.com>
* 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.
2002-08-17 Christopher Faylor <cgf@redhat.com> 2002-08-17 Christopher Faylor <cgf@redhat.com>
* malloc.cc: Update to 2.7.2. * malloc.cc: Update to 2.7.2.
* malloc_wrapper.cc (malloc_init): Call user level mallocs to determine * malloc_wrapper.cc (malloc_init): Call user level mallocs to determine
if the malloc has been wrapped. if the malloc routines have been overridden.
2002-08-16 Christopher Faylor <cgf@redhat.com> 2002-08-16 Christopher Faylor <cgf@redhat.com>

View File

@ -20,7 +20,9 @@ extern "C" int dlmallopt (int p, int v) __attribute__ ((regparm (2)));
extern "C" void dlmalloc_stats (); extern "C" void dlmalloc_stats ();
#ifndef __INSIDE_CYGWIN__ #ifndef __INSIDE_CYGWIN__
# define USE_DL_PREFIX # define USE_DL_PREFIX 1
# define MORECORE_CANNOT_TRIM 1
# define DEBUG 1
#else #else
# define __malloc_lock() mallock->acquire () # define __malloc_lock() mallock->acquire ()
# define __malloc_unlock() mallock->release () # define __malloc_unlock() mallock->release ()

View File

@ -615,7 +615,9 @@ sig_handle_tty_stop (int sig)
} }
sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p", sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
myself->pid, sig, myself->ppid_handle); myself->pid, sig, myself->ppid_handle);
SuspendThread (hMainThread); if (WaitForSingleObject (sigCONT, INFINITE) != WAIT_OBJECT_0)
api_fatal ("WaitSingleObject failed, %E");
(void) ResetEvent (sigCONT);
return; return;
} }
} }
@ -992,6 +994,7 @@ sig_handle (int sig, bool thisproc)
/* FIXME: Should we still do this if SIGCONT has a handler? */ /* FIXME: Should we still do this if SIGCONT has a handler? */
if (sig == SIGCONT) if (sig == SIGCONT)
{ {
DWORD stopped = myself->process_state & PID_STOPPED;
myself->stopsig = 0; myself->stopsig = 0;
myself->process_state &= ~PID_STOPPED; myself->process_state &= ~PID_STOPPED;
/* Clear pending stop signals */ /* Clear pending stop signals */
@ -999,10 +1002,8 @@ sig_handle (int sig, bool thisproc)
sig_clear (SIGTSTP); sig_clear (SIGTSTP);
sig_clear (SIGTTIN); sig_clear (SIGTTIN);
sig_clear (SIGTTOU); sig_clear (SIGTTOU);
/* Windows 95 hangs on resuming non-suspended thread */ if (stopped)
SuspendThread (hMainThread); SetEvent (sigCONT);
while (ResumeThread (hMainThread) > 1)
;
/* process pending signals */ /* process pending signals */
sig_dispatch_pending (1); sig_dispatch_pending (1);
} }

View File

@ -80,34 +80,35 @@ HANDLE NO_COPY signal_arrived; // Event signaled when a signal has
Static DWORD proc_loop_wait = 1000; // Wait for subprocesses to exit Static DWORD proc_loop_wait = 1000; // Wait for subprocesses to exit
Static DWORD sig_loop_wait = INFINITE; // Wait for signals to arrive Static DWORD sig_loop_wait = INFINITE; // Wait for signals to arrive
Static HANDLE sigcatch_nonmain = NULL; // The semaphore signaled when Static HANDLE sigcatch_nonmain; // The semaphore signaled when
// signals are available for // signals are available for
// processing from non-main thread // processing from non-main thread
Static HANDLE sigcatch_main = NULL; // Signalled when main thread sends a Static HANDLE sigcatch_main; // Signalled when main thread sends a
// signal // signal
Static HANDLE sigcatch_nosync = NULL; // Signal wait_sig to scan sigtodo Static HANDLE sigcatch_nosync; // Signal wait_sig to scan sigtodo
// but not to bother with any // but not to bother with any
// synchronization // synchronization
Static HANDLE sigcomplete_main = NULL; // Event signaled when a signal has Static HANDLE sigcomplete_main; // Event signaled when a signal has
// finished processing for the main // finished processing for the main
// thread // thread
Static HANDLE sigcomplete_nonmain = NULL;// Semaphore raised for non-main Static HANDLE sigcomplete_nonmain; // Semaphore raised for non-main
// threads when a signal has finished // threads when a signal has finished
// processing // processing
HANDLE NO_COPY sigCONT; // Used to "STOP" a process
Static cygthread *hwait_sig; // Handle of wait_sig thread Static cygthread *hwait_sig; // Handle of wait_sig thread
Static cygthread *hwait_subproc; // Handle of sig_subproc thread Static cygthread *hwait_subproc; // Handle of sig_subproc thread
Static HANDLE wait_sig_inited = NULL; // Control synchronization of Static HANDLE wait_sig_inited; // Control synchronization of
// message queue startup // message queue startup
/* Used by WaitForMultipleObjects. These are handles to child processes. /* Used by WaitForMultipleObjects. These are handles to child processes.
*/ */
Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++ Static HANDLE events[PSIZE + 1]; // All my children's handles++
#define hchildren (events + 1) // Where the children handles begin #define hchildren (events + 1) // Where the children handles begin
Static char cpchildren[PSIZE * sizeof (pinfo)]; // All my children info Static char cpchildren[PSIZE * sizeof (pinfo)]; // All my children info
Static int nchildren = 0; // Number of active children Static int nchildren; // Number of active children
Static char czombies[NZOMBIES * sizeof (pinfo)]; // All my deceased children info Static char czombies[NZOMBIES * sizeof (pinfo)]; // All my deceased children info
Static int nzombies = 0; // Number of deceased children Static int nzombies; // Number of deceased children
#define pchildren ((pinfo *) cpchildren) #define pchildren ((pinfo *) cpchildren)
#define zombies ((pinfo *) czombies) #define zombies ((pinfo *) czombies)
@ -1048,6 +1049,7 @@ wait_sig (VOID *self)
sigcomplete_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL); sigcomplete_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
sigcomplete_main = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL); sigcomplete_main = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
sigproc_printf ("sigcatch_nonmain %p, sigcatch_main %p", sigcatch_nonmain, sigcatch_main); sigproc_printf ("sigcatch_nonmain %p, sigcatch_main %p", sigcatch_nonmain, sigcatch_main);
sigCONT = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
/* Setting dwProcessId flags that this process is now capable of receiving /* Setting dwProcessId flags that this process is now capable of receiving
* signals. Prior to this, dwProcessId was set to the windows pid of * signals. Prior to this, dwProcessId was set to the windows pid of

View File

@ -95,6 +95,7 @@ public:
extern sigthread mainthread; extern sigthread mainthread;
extern HANDLE signal_arrived; extern HANDLE signal_arrived;
extern HANDLE sigCONT;
BOOL __stdcall my_parent_is_alive (); BOOL __stdcall my_parent_is_alive ();
extern "C" int __stdcall sig_dispatch_pending (int force = FALSE); extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);