[commit: ghc] ghc-8.0: base: Document caveats about Control.Concurrent.Chan (50a2b6a)

git at git.haskell.org git at git.haskell.org
Tue Mar 29 10:38:14 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/50a2b6af30f86a96384f608b145eb453ba45bcb4/ghc

>---------------------------------------------------------------

commit 50a2b6af30f86a96384f608b145eb453ba45bcb4
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Mon Mar 28 14:52:35 2016 +0200

    base: Document caveats about Control.Concurrent.Chan
    
    These are implemented using `MVars` which have known caveats. Suggest
    the use of `TChan` from the stm library instead.
    
    Test Plan: n/a
    
    Reviewers: austin, hvr, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2047
    
    (cherry picked from commit 0f0c1387882be6a19af2cf3e6a005d70a3e84ae7)


>---------------------------------------------------------------

50a2b6af30f86a96384f608b145eb453ba45bcb4
 libraries/base/Control/Concurrent/Chan.hs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libraries/base/Control/Concurrent/Chan.hs b/libraries/base/Control/Concurrent/Chan.hs
index f5785f5..ed8e02b 100644
--- a/libraries/base/Control/Concurrent/Chan.hs
+++ b/libraries/base/Control/Concurrent/Chan.hs
@@ -14,6 +14,11 @@
 --
 -- Unbounded channels.
 --
+-- The channels are implemented with @MVar at s and therefore inherit all the
+-- caveats that apply to @MVar at s (possibility of races, deadlocks etc). The
+-- stm (software transactional memory) library has a more robust implementation
+-- of channels called @TChan at s.
+--
 -----------------------------------------------------------------------------
 
 module Control.Concurrent.Chan



More information about the ghc-commits mailing list