> I don't understand the "tryButDoNotSuspend" operation. What does it mean,
> "would lead to an immediate suspension of the current thread"?
Apparently, this part of my pseudo-implementation caused some confusion.
It was simply an attempt to factor the behaviour of putMVar into smaller
parts. Assuming that we have something like
blocking putMVar : check if free then place data or queue thread
non-blocking putMVar : check if free then place data or throw exception
there is some overlap here and similarly for takeMVar. Due to the
problems of atomic test&set operations in a concurrent setting, this
overlap might only be visible in low-level implementation code, whereas
I tried to give the overlap a name in a Haskell pseudo-code style
description. So there isn't anything deep in there, and to avoid
unneccessary confusion, I will not repeat the pseudo-Haskell code here.
The point of the exercise was to show that putMVar and takeMVar are
built from smaller parts, which are not currently accessible from Haskell.
It may or may not possible to change this, but more importantly, there
are some odd defaults built into the current non-blocking putMVar, and
some alternatives not offered. See the original email for a more
complete list.
Claus