
27 Mar
2006
27 Mar
'06
6:13 a.m.
John Goerzen
On Fri, Mar 24, 2006 at 11:07:53AM +0000, Malcolm Wallace wrote:
I assume that since a non-concurrent implementation has only one thread, that thread will be trying to MVar-synchronise with something that does not exist, and hence be blocked for ever.
Not necessarily. An MVar is a useful tool in place of an IORef. It works well when a given hunk of code is used in a threaded program, but it also works well in a non-threaded program. If they are used correctly, there is no problem.
Your final sentence is the one that I want to emphasise. What does it mean to use an MVar "correctly", such that one can avoid blocking in a non-threaded implementation? Regards, Malcolm