From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 95A983852741; Wed, 31 Aug 2022 08:07:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95A983852741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661933244; bh=huWaEMu1zpAzIgUydpBE+d91V6ArCautdCahkIl/c2M=; h=From:To:Subject:Date:From; b=sNjFv1K5ysc2u5oIv8UbcM5bjtEn+Uy0Jr0iXPpncowgfn/wKh3gj2zlR/n8hl1pI EzSHa12XHAGarWHfWTs5aKIrP7lOxdhHdj5IQNitOQtF3qCyIdnUNEwt/RGQDp1BGU NLZuh0wQnR7tmfWpLANvm07ExVYfZVZOiw9qKcVA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Restore _lock initialization in non-single threaded mode X-Act-Checkin: newlib-cygwin X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Git-Refname: refs/heads/master X-Git-Oldrev: b4561c236357c32290321fade62b5c81a5a9fe3c X-Git-Newrev: dd1122e21cb4ea78ce4c5894787c8f085469f9dd Message-Id: <20220831080724.95A983852741@sourceware.org> Date: Wed, 31 Aug 2022 08:07:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Ddd1122e21cb= 4ea78ce4c5894787c8f085469f9dd commit dd1122e21cb4ea78ce4c5894787c8f085469f9dd Author: Torbj=C3=B6rn SVENSSON Date: Tue Aug 30 15:54:53 2022 +0200 Restore _lock initialization in non-single threaded mode =20 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. =20 This is more or less a revert of 382550072b49430f8c69adee937a0ba07bd385= e6 =20 Contributed by STMicroelectronics =20 Signed-off-by: Torbj=C3=B6rn SVENSSON Diff: --- 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, #else /* _STDIO_CLOSE_STD_STREAMS */ ptr->_close =3D NULL; #endif /* _STDIO_CLOSE_STD_STREAMS */ +#ifndef __SINGLE_THREAD__ + if (ptr =3D=3D &__sf[0] || ptr =3D=3D &__sf[1] || ptr =3D=3D &__sf[2]) + __lock_init_recursive (ptr->_lock); +#endif #ifdef __SCLE if (__stextmode (ptr->_file)) ptr->_flags |=3D __SCLE;