What does this have to do with contention for stdout? Thread switching is unrelated; seeing individual output operations just gives more hints about when the thread switches happen. And with -fno-omit-yields it presumably can happen when putChar is evaluated, not because of I/O but because of function entry.

On Thu, Nov 29, 2018 at 2:49 PM Johannes Waldmann <johannes.waldmann@htwk-leipzig.de> wrote:
> so thread scheduling would be more obvious with individual
> characters being output instead of a single flush triggered by the final
> putChar.

Yes but in my example program, there is no contention for stdout,
as only one thread is using it.

I am inclined to enter this into the GHC issue tracker
as it seems there's no obvious explanation,
and "lost TVars confusing the STM machinery" was mentioned.
Do you mean that this a known thing? Searching the tracker
for "lost TVar" does not turn up anything.

- J.W.


--
brandon s allbery kf8nh
allbery.b@gmail.com