On Tuesday, 25 July 2017 at 19:22:11 UTC, Marco Leise wrote:
Since I/O is thread-safe[1], it should ideally be `shared`
the way you put it.
Also it sounds like a bad decision.
void f()
{
printf("hello ");
printf("world\n");
}
If you have shared stdout and this function runs in 2 threads,
you will get a character soup
---
hello hello world
world
---
If you have a separate line buffered stdout for each thread, you
will get whole lines in the output
---
hello world
hello world
---
And incur no locking.