* [PATCH] Restore _lock initialization in single threaded mode
@ 2022-08-29 15:10 Torbjörn SVENSSON
2022-08-29 19:33 ` Jeff Johnston
0 siblings, 1 reply; 6+ messages in thread
From: Torbjörn SVENSSON @ 2022-08-29 15:10 UTC (permalink / raw)
To: newlib; +Cc: Torbjörn SVENSSON
When __SINGLE_THREAD__ is 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
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
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..f7249f6d7 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 = 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;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Restore _lock initialization in single threaded mode
2022-08-29 15:10 [PATCH] Restore _lock initialization in single threaded mode Torbjörn SVENSSON
@ 2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:35 ` Torbjorn SVENSSON
0 siblings, 2 replies; 6+ messages in thread
From: Jeff Johnston @ 2022-08-29 19:33 UTC (permalink / raw)
To: Torbjörn SVENSSON; +Cc: Newlib
Hi Torbjorn,
Could you clarify? Your description and title says when SINGLE_THREAD, but
your patch is #ifndef __SINGLE_THREAD__.
-- Jeff J.
On Mon, Aug 29, 2022 at 11:11 AM Torbjörn SVENSSON <
torbjorn.svensson@foss.st.com> wrote:
> When __SINGLE_THREAD__ is 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
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
> 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..f7249f6d7 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 = 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;
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Restore _lock initialization in single threaded mode
2022-08-29 19:33 ` Jeff Johnston
@ 2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:35 ` Torbjorn SVENSSON
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Johnston @ 2022-08-29 19:33 UTC (permalink / raw)
To: Torbjörn SVENSSON; +Cc: Newlib
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Hi Torbjorn,
Could you clarify? Your description and title says when SINGLE_THREAD, but
your patch is #ifndef __SINGLE_THREAD__.
-- Jeff J.
On Mon, Aug 29, 2022 at 11:11 AM Torbjörn SVENSSON <
torbjorn.svensson@foss.st.com> wrote:
> When __SINGLE_THREAD__ is 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
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
> 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..f7249f6d7 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 = 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;
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Restore _lock initialization in single threaded mode
2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:33 ` Jeff Johnston
@ 2022-08-29 19:35 ` Torbjorn SVENSSON
1 sibling, 0 replies; 6+ messages in thread
From: Torbjorn SVENSSON @ 2022-08-29 19:35 UTC (permalink / raw)
To: Jeff Johnston; +Cc: Newlib
Hello Jeff,
The description should have included a "not". Sorry about that.
Kind regards,
Torbjörn
On 2022-08-29 21:33, Jeff Johnston wrote:
> Hi Torbjorn,
>
> Could you clarify? Your description and title says when SINGLE_THREAD,
> but your patch is #ifndef __SINGLE_THREAD__.
>
> -- Jeff J.
>
> On Mon, Aug 29, 2022 at 11:11 AM Torbjörn SVENSSON
> <torbjorn.svensson@foss.st.com <mailto:torbjorn.svensson@foss.st.com>>
> wrote:
>
> When __SINGLE_THREAD__ is 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
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com
> <mailto:torbjorn.svensson@foss.st.com>>
> ---
> 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..f7249f6d7 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 = 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;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Restore _lock initialization in single threaded mode
@ 2022-08-29 18:18 Torbjörn SVENSSON
2022-08-29 18:18 ` Torbjörn SVENSSON
0 siblings, 1 reply; 6+ messages in thread
From: Torbjörn SVENSSON @ 2022-08-29 18:18 UTC (permalink / raw)
To: newlib; +Cc: Torbjörn SVENSSON
When __SINGLE_THREAD__ is 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
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
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..f7249f6d7 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 = 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;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Restore _lock initialization in single threaded mode
2022-08-29 18:18 Torbjörn SVENSSON
@ 2022-08-29 18:18 ` Torbjörn SVENSSON
0 siblings, 0 replies; 6+ messages in thread
From: Torbjörn SVENSSON @ 2022-08-29 18:18 UTC (permalink / raw)
To: newlib
When __SINGLE_THREAD__ is 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
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
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..f7249f6d7 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 = 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;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-08-29 19:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 15:10 [PATCH] Restore _lock initialization in single threaded mode Torbjörn SVENSSON
2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:33 ` Jeff Johnston
2022-08-29 19:35 ` Torbjorn SVENSSON
2022-08-29 18:18 Torbjörn SVENSSON
2022-08-29 18:18 ` Torbjörn SVENSSON
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).