summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-10-02 04:46:59 +0000
committerChristopher Faylor <me@cgf.cx>2003-10-02 04:46:59 +0000
commit89238062995e04a31600ccad4d5605064c63998e (patch)
tree8a277492502952f5c94d608b8fefb1f478f610e6 /winsup/cygwin/dcrt0.cc
parent6cb54a4ceef86fbc1e83e2f2a79d1d4f120fde04 (diff)
downloadcygnal-89238062995e04a31600ccad4d5605064c63998e.tar.gz
cygnal-89238062995e04a31600ccad4d5605064c63998e.tar.bz2
cygnal-89238062995e04a31600ccad4d5605064c63998e.zip
* dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that stdio
buffers are initialized to avoid thread initialization races.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 377d6dd6f..a09b7e81b 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -533,6 +533,8 @@ sigthread::init (const char *s)
id = GetCurrentThreadId ();
}
+extern "C" void __sinit (_reent *);
+
/* Take over from libc's crt0.o and start the application. Note the
various special cases when Cygwin DLL is being runtime loaded (as
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,
otherwise it is reinitalized in fixup_after_fork */
if (!user_data->forkee)
- pthread::init_mainthread ();
+ {
+ __sinit (_impure_ptr);
+ pthread::init_mainthread ();
+ }
#ifdef DEBUGGING
strace.microseconds ();