diff options
author | Matt Joyce <matthew.joyce@embedded-brains.de> | 2022-02-22 11:18:38 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2022-02-22 12:38:46 +0100 |
commit | 44b60f0c4ba597c55dcac4f2d3119a3055c80ba1 (patch) | |
tree | e5286802e8b24fcbb7437f00163daaab0f439f2c /winsup/cygwin/dcrt0.cc | |
parent | 054b00d96a81ca1169a1dd2d63d79b7ac03919ac (diff) | |
download | newlib-44b60f0c4ba597c55dcac4f2d3119a3055c80ba1.zip newlib-44b60f0c4ba597c55dcac4f2d3119a3055c80ba1.tar.gz newlib-44b60f0c4ba597c55dcac4f2d3119a3055c80ba1.tar.bz2 |
Make __sdidinit unused
Remove dependency on __sdidinit member of struct _reent to check
object initialization. Like __sdidinit, the __cleanup member of
struct _reent is initialized in the __sinit() function. Checking
initialization against __cleanup serves the same purpose and will
reduce overhead in the __sfp() function in a follow up patch.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f3d09c1..e757c47 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -824,15 +824,13 @@ main_thread_sinit () As soon as the main thread calls a stdio function, this would be rectified. But if another thread calls a stdio function on stdin/out/err before the main thread does, all the required - initialization of stdin/out/err will be done, but _REENT->__sdidinit - is *still* 0. This in turn will result in a call to __sinit in the + initialization of stdin/out/err will be done, but _REENT->__cleanup + is *still* NULL. This in turn will result in a call to __sinit in the wrong spot. The input or output buffer will be NULLed and nothing is read or written in the first stdio function call in the main thread. - To fix this issue we have to copy over the relevant part of _GLOBAL_REENT - to _REENT here again. */ - _REENT->__sdidinit = -1; - _REENT->__cleanup = _GLOBAL_REENT->__cleanup; + To fix this issue we set __cleanup to _cygtls::cleanup_early here. */ + _REENT->__cleanup = _cygtls::cleanup_early; } /* Take over from libc's crt0.o and start the application. Note the |