Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/dcrt0.cc7
2 files changed, 11 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 41c60710a..59bd2eb93 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* path.cc (win32_device_name): Only fill out destination buffer when
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 ();