From edc4f86ad282702ab7c029cf65b87ec616bda05e Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 13 Feb 2004 19:34:32 +0000 Subject: * Makefile.in (clean): Remove sigfe.s. (sigfe.s): Ensure that sigfe.s will be regenerated if it does not exist. * dll_init.cc (dll_dllcrt0): Simplify initializing tests. * exceptions.cc (setup_handler): Detect when stub caller is either spinning or has acquired the lock after being suspended to avoid windows problems with suspending a win32 API call. * cygtls.h (_cygtls::spinning): Declare new element. * gendef: Remove unused _siglist_index and _siglist declaration. (_sigfe): Set spinning element when potentially looping, waiting for lock. (_sigbe): Ditto. (_cygtls::lock): Ditto. (_longjmp): Ditto. * tlsoffsets.h: Regenerate. * pinfo.cc (_pinfo::exit): Set final exit state here. Call sigproc_terminate if invoked with 'norecord'. Clear any residual _cygtls stuff. * winsup.h (exit_states): Define ES_FINAL. * spawn.cc (spawn_guts): Don't call proc_terminate specifically when execing. Let _pinfo::exit handle that case. * sigproc.cc (wait_subproc): Always exit loop early when proc_loop_wait. * init.cc (munge_threadfunc): Eliminate unused argument. (dll_entry): Reflect above change in call to munge_threadfunc. --- winsup/cygwin/dll_init.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/dll_init.cc') diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index a1901a02d..a3817d76e 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -23,7 +23,7 @@ extern void __stdcall check_sanity_and_sync (per_process *); dll_list NO_COPY dlls; -static NO_COPY int in_forkee = 0; +static int NO_COPY in_forkee; static int dll_global_dtors_recorded; /* Run destructors for all DLLs on exit. */ @@ -183,7 +183,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type) void dll_list::detach (void *retaddr) { - if (!myself || myself->process_state == PID_EXITED) + if (!myself || exit_state) return; MEMORY_BASIC_INFORMATION m; if (!VirtualQuery (retaddr, &m, sizeof m)) @@ -358,6 +358,7 @@ dll_dllcrt0 (HMODULE h, per_process *p) p = &__cygwin_user_data; else *(p->impure_ptr_ptr) = __cygwin_user_data.impure_ptr; + bool initializing = in_forkee || cygwin_finished_initializing; /* Partially initialize Cygwin guts for non-cygwin apps. */ if (dynamically_loaded && user_data->magic_biscuit == 0) @@ -371,7 +372,7 @@ dll_dllcrt0 (HMODULE h, per_process *p) initializing, then the DLL must be a cygwin-aware DLL that was explicitly linked into the program rather than a dlopened DLL. */ - if (!in_forkee && !cygwin_finished_initializing) + if (!initializing) type = DLL_LINK; else { @@ -387,7 +388,7 @@ dll_dllcrt0 (HMODULE h, per_process *p) initialize the DLL. If we haven't finished initializing, it may not be safe to call the dll's "main" since not all of cygwin's internal structures may have been set up. */ - if (!d || ((in_forkee || cygwin_finished_initializing) && !d->init ())) + if (!d || (initializing && !d->init ())) return -1; return (DWORD) d; -- cgit v1.2.3