IORefs, MVars und CVars

Dean Herington heringto@cs.unc.edu
Tue, 21 Jan 2003 09:29:51 -0500


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