[PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS

Corinna Vinschen vinschen@redhat.com
Fri Jun 30 10:35:00 GMT 2017


On Jun 30 10:58, Sebastian Huber wrote:
> 
> 
> ----- Am 30. Jun 2017 um 10:13 schrieb Corinna Vinschen vinschen@redhat.com:
> 
> > On Jun 30 07:43, Sebastian Huber wrote:
> >> On 29/06/17 20:31, Corinna Vinschen wrote:
> >> 
> >> > And, JFYI, Cygwin will start to use it too after the next release:)
> >> 
> >> There are some new problems with this change. We have no reference counting
> >> in the FILE objects, so a freopen(..., stdin), closes the global stdin FILE
> >> object (__sf[0]), etc. What works is a stdin = fopen(). I guess this could
> >> break existing applications.
> > 
> > Erm... isn't that expected behaviour?  stdin/stdout/stderr are global
> > objects, after all.  They were never thread-local per POSIX.
> 
> The stdin/stdout/stderr pointers are still thread-local with this
> option. Only the FILE objects itself are now global. If you do a stdin
> = fopen() you get a completely thread-local stdin. I have absolutely
> no idea why this stuff is thread-local in Newlib by default.

Me neither.  This predates my involvement in newlib.

I guess it sounded like a good idea at the time, to allow multiple,
independent applets on bare metal systems.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170630/e6a8717e/attachment.sig>


More information about the Newlib mailing list