From 2a3bf3e2cee2ddce5d6f6951d948a307260015e8 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 10 Oct 2002 05:23:23 +0000 Subject: [PATCH] * Makefile.in (new-cygwin1.dll): Reorganize library order. * dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads are terminated during vfork. * sigproc.cc (proc_terminate): Grab proc lock prior to signalling subproc thread exit to avoid an extra "wait-for-thread-to-exit". --- winsup/cygwin/ChangeLog | 21 +++++++++++++++------ winsup/cygwin/Makefile.in | 4 ++-- winsup/cygwin/dcrt0.cc | 12 ++++++------ winsup/cygwin/sigproc.cc | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e006d7efa..7ed69ffaf 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-10-10 Christopher Faylor + + * Makefile.in (new-cygwin1.dll): Reorganize library order. + + * dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads + are terminated during vfork. + * sigproc.cc (proc_terminate): Grab proc lock prior to signalling + subproc thread exit to avoid an extra "wait-for-thread-to-exit". + 2002-10-09 Christopher Faylor * cygthread.cc (cygthread::stub): Don't create an event for "cygself" @@ -93,7 +102,7 @@ * thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining why. (pthreadNull::_instance): Copy on fork. Absolutely no state exists - in pthreadNull. + in pthreadNull. 2002-09-30 Conrad Scott @@ -127,8 +136,8 @@ (pthread_mutex::nativeMutex::init): Implement. (pthread_mutex::nativeMutex::lock): Ditto. (pthread_mutex::nativeMutex::unlock): Ditto. - (pthread_mutex::init): Use the wrapper lock and unlockcalls. - * thread.h (pthread_mutex): Move mutexInitializationLock into a + (pthread_mutex::init): Use the wrapper lock and unlockcalls. + * thread.h (pthread_mutex): Move mutexInitializationLock into a nativeMutex wrapper class. 2002-09-30 Christopher Faylor @@ -166,7 +175,7 @@ * pthread.cc (pthread_mutex_init): Use new pthread_mutex::init. * thread.cc: Change __pthread_mutex_init to pthread_mutex::init throughout. - (MTinterface::Init): Initialise pthread_mutex support. + (MTinterface::Init): Initialise pthread_mutex support. (pthread_mutex::mutexInitializationLock): Instantiate. (pthread_mutex::initMutex): New method. (__pthread_cond_dowait): Don't dereference untrusted pointers. @@ -175,7 +184,7 @@ (__pthread_mutex_init): Rename to pthread_mutex::init. Lock and release mutexInitializationLock to prevent races on mutex initialisation. - * thread.h (pthread_mutex::initMutex): New method, initialise + * thread.h (pthread_mutex::initMutex): New method, initialise pthread_mutex supporting state on process initialisation. (pthread_mutex::init): Initialise a single mutex. (pthread_mutex::mutexInitializationLock): A win32 mutex for @@ -1714,7 +1723,7 @@ * fhandler_process.cc: Add include. (format_process_stat): Make number of 'jiffies' per second same as HZ define. Use KernelTime and UserTime only to calculate start_time. - + 2002-08-30 Christopher Faylor (inspired by a patch from Egor Duda) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 9a28dac1b..218d9de23 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -257,8 +257,8 @@ maintainer-clean realclean: clean new-$(DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(LIBM) $(API_VER) Makefile winver_stamp $(CXX) $(CXXFLAGS) -nostdlib -Wl,-T$(firstword $^) -Wl,--out-implib,cygdll.a -shared -o $@ \ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \ - $(MALLOC_OBJ) $(LIBM) $(LIBC) \ - -lstdc++ -lgcc $(DLL_IMPORTS) + $(MALLOC_OBJ) $(LIBM) -lstdc++ $(LIBC) \ + -lgcc $(DLL_IMPORTS) # Rule to build libcygwin.a $(LIB_NAME): rmsym newsym new-$(DLL_NAME) $(LIBCOS) diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 2959c6f08..f55b26d22 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -959,6 +959,12 @@ do_exit (int status) UINT n = (UINT) status; static int NO_COPY exit_state = 0; + syscall_printf ("do_exit (%d)", n); + + vfork_save *vf = vfork_storage.val (); + if (vf != NULL && vf->pid < 0) + vf->restore_exit (status); + if (!DisableThreadLibraryCalls (cygwin_hmodule)) system_printf ("DisableThreadLibraryCalls (%p) failed, %E", cygwin_hmodule); @@ -969,12 +975,6 @@ do_exit (int status) cygthread::terminate (); } - syscall_printf ("do_exit (%d)", n); - - vfork_save *vf = vfork_storage.val (); - if (vf != NULL && vf->pid < 0) - vf->restore_exit (status); - if (exit_state < ES_SIGNAL) { exit_state = ES_SIGNAL; diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 8cc459c1c..db5626b89 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -457,10 +457,10 @@ proc_terminate (void) if (hwait_subproc) { proc_loop_wait = 0; // Tell wait_subproc thread to exit + sync_proc_subproc->acquire (WPSP); wake_wait_subproc (); // Wake wait_subproc loop hwait_subproc = NULL; - sync_proc_subproc->acquire (WPSP); (void) proc_subproc (PROC_CLEARWAIT, 1); /* Clean out zombie processes from the pid list. */ -- 2.43.5