stdout and stderr are getting mixed up?

Chris Johns chrisj at rtems.org
Thu Jun 22 06:16:56 UTC 2017


On 22/06/2017 16:08, Sebastian Huber wrote:
> On 22/06/17 08:01, Chris Johns wrote:
> 
>> On 22/06/2017 15:54, Sebastian Huber wrote:
>>> The Newlib _vfprintf_r() implementation locks the file stream, so it does ensure
>>> this atomicity.
>>>> We have thread-local stdio streams in Newlib.
>> Could you please elaborate what this means?
> 
> Concurrent fprintf(), etc. invocations are serialized in Newlib with respect to
> a specific FILE object. 

Is the FILE* pointer in the TLS or what the pointer points too in the TLS as well?

> Due to the thread-local stdio streams you have many FILE
> objects. 

I have always considered stdout etc as singular. I can make as many copies of
the pointer as I like but not the object itself.

> You have a common output device via file descriptors 0, 1 and 2.

Are you saying for stdout it is working but stdout and stderr in different
threads the behavior posted can be as observed?

> The use of locks in Newlib is new in RTEMS 4.12 by the way.

OK.

Chris


More information about the users mailing list