Simon Marlow wrote:
> There's one implementation issue related to efficiency that springs to mind:
> in GHC, a primitive which blocks or does any allocation must be an
> out-of-line function.  This means that non-blocking put or takeMVar can be
> inline primitives (although putMVar is currently out-of-line to avoid code
> duplication).
I don't understand this.  If out-of-line means giving the scheduler/garbage-collector
a chance to do things, couldn't you just make the blocking versions only go out-of-
line if they have to block?  In many cases I suspect the takeMVar and putMVar
will work immediately, so this could be a useful saving. 

I like the scheme for blocking and non-blocking versions of take/putMVar in
general.  If you are working in this area, the function I suggested

takeMVarMulti :: [MVar a] -> IO a
   and in addition
putMVarMulti :: [MVar a] -> a -> IO ()
could conceivably be useful to me in the future, so I'd like them too,
if they're trivial to add.

Reply via email to