public inbox for
help / color / mirror / Atom feed
* [newlib-cygwin] Restore _lock initialization in non-single threaded mode
@ 2022-08-31  8:07 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-08-31  8:07 UTC (permalink / raw)
  To: newlib-cvs;h=dd1122e21cb4ea78ce4c5894787c8f085469f9dd

commit dd1122e21cb4ea78ce4c5894787c8f085469f9dd
Author: Torbjörn SVENSSON <>
Date:   Tue Aug 30 15:54:53 2022 +0200

    Restore _lock initialization in non-single threaded mode
    When __SINGLE_THREAD__ is not defined, stdin, stdout and stderr needs
    to have their _lock instance initialized. The __sfp() method is not
    invoked for the 3 mentioned fds thus, the std() method needs to handle
    the initialization of the lock.
    This is more or less a revert of 382550072b49430f8c69adee937a0ba07bd385e6
    Contributed by STMicroelectronics
    Signed-off-by: Torbjörn SVENSSON <>

 newlib/libc/stdio/findfp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index c43028209..2cc549537 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -88,6 +88,10 @@ std (FILE *ptr,
   ptr->_close = NULL;
+#ifndef __SINGLE_THREAD__
+  if (ptr == &__sf[0] || ptr == &__sf[1] || ptr == &__sf[2])
+    __lock_init_recursive (ptr->_lock);
 #ifdef __SCLE
   if (__stextmode (ptr->_file))
     ptr->_flags |= __SCLE;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-31  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  8:07 [newlib-cygwin] Restore _lock initialization in non-single threaded mode Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).