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 382550072b

Contributed by STMicroelectronics

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
This commit is contained in:
Torbjörn SVENSSON 2022-08-30 15:54:53 +02:00 committed by Corinna Vinschen
parent b4561c2363
commit dd1122e21c
1 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,10 @@ std (FILE *ptr,
#else /* _STDIO_CLOSE_STD_STREAMS */
ptr->_close = NULL;
#endif /* _STDIO_CLOSE_STD_STREAMS */
#ifndef __SINGLE_THREAD__
if (ptr == &__sf[0] || ptr == &__sf[1] || ptr == &__sf[2])
__lock_init_recursive (ptr->_lock);
#endif
#ifdef __SCLE
if (__stextmode (ptr->_file))
ptr->_flags |= __SCLE;