This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Do threads within single process share FILE streams?
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Wed, 21 Jan 2015 19:11:08 +0100
- Subject: Do threads within single process share FILE streams?
- Authentication-results: sourceware.org; auth=none
Hello!
I know this list is not perfect for such question, but I'm sure you know
the answer (; I really couldn't find anything definitive on the internet...
Do threads within single process share FILE streams? I know that threads
share file descriptors, but do they share FILE streams too? Newlib's
source suggests that FILE streams are _NOT_ shared between threads -
they are allocated in _reent structure, which is (I assume) per thread.
But on the other hand - if FILE streams are not shared (implicitly),
then the locking (with _newlib_flockfile_start() and
_newlib_flockfile_end()) is mostly pointless and would make sense only
when you share the FILE streams explicitly by using the same FILE
variable from multiple threads, right?
Thanks in advance!
Regards,
FCh