Revert the reversion and go with implementation described in cgf-000017, with

some modifications.
* init.cc (dll_entry): Revert previous change.
* miscfuncs.cc: Include sigproc.h for exit_thread declaration.
* winsup.h (ExitThread): Define as 'exit_thread' to ensure no accidental use.
* sigproc.cc (exit_thread): New function.
(wait_sig): Handle __SIGTHREADEXIT case.  Don't just block rather than
returning from this function.
* sigproc.h (__SIGTHREADEXIT): New enum.
(exit_thread): Declare.
* sync.cc (muto::release): Accept a tls command-line argument.
* sync.h (muto::release): Accept a tls command-line parameter.  Default to
&_my_tls.
* cygerrno.h (__set_errno): Define as extern so that no function code is ever
emitted.
* cygserver_ipc.h (cygserver_ipc.h): Ditto.
* miscfuncs.h (transform_chars): Ditto.
* path.h (has_attribute): Ditto.
* security.h (privilege_luid): Ditto.
* winsup.h (flush_file_buffers): Ditto.
This commit is contained in:
Christopher Faylor
2012-12-21 21:30:56 +00:00
parent 65068ebd7f
commit c3a4634985
13 changed files with 93 additions and 23 deletions

View File

@ -13,7 +13,6 @@ details. */
#include "cygtls.h"
#include "ntdll.h"
#include "shared_info.h"
#include "sync.h"
static DWORD _my_oldfunc;
@ -96,14 +95,7 @@ dll_entry (HANDLE h, DWORD reason, void *static_load)
if (dll_finished_loading
&& (PVOID) &_my_tls > (PVOID) &test_stack_marker
&& _my_tls.isinitialized ())
{
_my_tls.remove (0);
/* Make sure that we don't exit until the process has exited.
Otherwise there is a potential race where the thread exit
code could be considered to be the process exit code.
See cgf-000017 and cgf-000018 in DevNotes. */
lock_process here;
}
_my_tls.remove (0);
/* Windows 2000 has a bug in NtTerminateThread. Instead of releasing
the stack at teb->DeallocationStack it uses the value of
teb->Tib.StackLimit to evaluate the stack address. So we just claim