diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8f87dbc44..a27e1980a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,8 +1,18 @@ +2002-08-18 Christopher Faylor + + * 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 * malloc.cc: Update to 2.7.2. * 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 diff --git a/winsup/cygwin/cygmalloc.h b/winsup/cygwin/cygmalloc.h index 818d56ee3..8c7fc3f9a 100644 --- a/winsup/cygwin/cygmalloc.h +++ b/winsup/cygwin/cygmalloc.h @@ -20,7 +20,9 @@ extern "C" int dlmallopt (int p, int v) __attribute__ ((regparm (2))); extern "C" void dlmalloc_stats (); #ifndef __INSIDE_CYGWIN__ -# define USE_DL_PREFIX +# define USE_DL_PREFIX 1 +# define MORECORE_CANNOT_TRIM 1 +# define DEBUG 1 #else # define __malloc_lock() mallock->acquire () # define __malloc_unlock() mallock->release () 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); } diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 49c8bda57..b43057e1c 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -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 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 // 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 -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 // 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 // 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 // processing +HANDLE NO_COPY sigCONT; // Used to "STOP" a process Static cygthread *hwait_sig; // Handle of wait_sig 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 /* 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 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 int nzombies = 0; // Number of deceased children +Static int nzombies; // Number of deceased children #define pchildren ((pinfo *) cpchildren) #define zombies ((pinfo *) czombies) @@ -1048,6 +1049,7 @@ wait_sig (VOID *self) sigcomplete_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL); sigcomplete_main = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL); 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 * signals. Prior to this, dwProcessId was set to the windows pid of diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index 36babecff..a461efdd6 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -95,6 +95,7 @@ public: extern sigthread mainthread; extern HANDLE signal_arrived; +extern HANDLE sigCONT; BOOL __stdcall my_parent_is_alive (); extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);