* dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that stdio

buffers are initialized to avoid thread initialization races.
This commit is contained in:
Christopher Faylor 2003-10-02 04:46:59 +00:00
parent 6cb54a4cee
commit 8923806299
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2003-10-02 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that
stdio buffers are initialized to avoid thread initialization races.
2003-10-01 Christopher Faylor <cgf@redhat.com> 2003-10-01 Christopher Faylor <cgf@redhat.com>
* path.cc (win32_device_name): Only fill out destination buffer when * path.cc (win32_device_name): Only fill out destination buffer when

View File

@ -533,6 +533,8 @@ sigthread::init (const char *s)
id = GetCurrentThreadId (); id = GetCurrentThreadId ();
} }
extern "C" void __sinit (_reent *);
/* Take over from libc's crt0.o and start the application. Note the /* Take over from libc's crt0.o and start the application. Note the
various special cases when Cygwin DLL is being runtime loaded (as various special cases when Cygwin DLL is being runtime loaded (as
opposed to being link-time loaded by Cygwin apps) from a non opposed to being link-time loaded by Cygwin apps) from a non
@ -633,7 +635,10 @@ dll_crt0_1 ()
/* Initialize pthread mainthread when not forked and it is save to call new, /* Initialize pthread mainthread when not forked and it is save to call new,
otherwise it is reinitalized in fixup_after_fork */ otherwise it is reinitalized in fixup_after_fork */
if (!user_data->forkee) if (!user_data->forkee)
{
__sinit (_impure_ptr);
pthread::init_mainthread (); pthread::init_mainthread ();
}
#ifdef DEBUGGING #ifdef DEBUGGING
strace.microseconds (); strace.microseconds ();