
I just started some multithreaded programming and as I am a newbie, I've gat a question. 1.) What are the differences between IORefs and MVars? 2.) What are CVars for? Thanks, Martin.

On Tue, 21 Jan 2003 08:56:55 +0100
Martin Huschenbett
I just started some multithreaded programming and as I am a newbie, I've gat a question.
1.) What are the differences between IORefs and MVars?
Mvars ensure mutual exclusion, and they can be used as sinchronyzing structures because they can be "empty" or "full"; they are not just like variables.
2.) What are CVars for?
Where did you find CVars? Vincenzo -- Teatri vuoti e inutili potrebbero affollarsi se tu ti proponessi di recitare te [CCCP]

Martin Huschenbett wrote:
2.) What are CVars for?
Originally, `putMVar` on a full MVar was an error. That meant that a single MVar was not enough to implement a one-element channel. So, a CVar was a pair of MVars that implemented a one-element channel. (See the paper "Concurrent Haskell" by Peyton Jones, Gordon, and Finne.) Now, the caller of `putMVar` pends if the MVar is full. So, a single MVar suffices to implement a one-element channel. Apparently CVars have since been removed from the Concurrent library. Dean
participants (3)
-
Dean Herington
-
Martin Huschenbett
-
Nick Name