I was wondering if it was possible to implement synchronous channels
within STM. In particular, I'd like to have CSP-like send and recv primitives
on a channel that each block until the other side arrives to complete
the transaction.

I think I've convinced myself that it's not possible, but
anyone care to differ?

Not quite the same thing, but you can implement synchronous message
passing fairly easily with MVars.  Here's a small example that
builds coroutines, courtesy of ddarius:

   http://codepad.org/GwtS6wMj

you could modify this slightly to have the receiver release the
sender as soon as the message is received, if that's what you wanted.
Is this close enough for you, or does it have to be in STM?

 cheers,
   rog.

Tim Newsham
http://www.thenewsh.com/~newsham/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to