summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/MVar.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-05-16 14:57:46 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-18 01:06:34 -0700
commita61aedc730e68a1b0c166b81a65a8ea575e8094b (patch)
tree85e0237044e1ec4bc29e1bfb80076055035eb6f7 /libraries/base/GHC/MVar.hs
parent191656199189e584e66dda194b7f772694388102 (diff)
downloadhaskell-a61aedc730e68a1b0c166b81a65a8ea575e8094b.tar.gz
SafeHaskell: Added SafeHaskell to base
Diffstat (limited to 'libraries/base/GHC/MVar.hs')
-rw-r--r--libraries/base/GHC/MVar.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/libraries/base/GHC/MVar.hs b/libraries/base/GHC/MVar.hs
index 8c653dca6a..e6d960e5e8 100644
--- a/libraries/base/GHC/MVar.hs
+++ b/libraries/base/GHC/MVar.hs
@@ -7,7 +7,7 @@
-- Module : GHC.MVar
-- Copyright : (c) The University of Glasgow 2008
-- License : see libraries/base/LICENSE
---
+--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portable (GHC Extensions)
@@ -27,11 +27,10 @@ module GHC.MVar (
, tryPutMVar -- :: MVar a -> a -> IO Bool
, isEmptyMVar -- :: MVar a -> IO Bool
, addMVarFinalizer -- :: MVar a -> IO () -> IO ()
-
- ) where
+ ) where
import GHC.Base
-import GHC.IO() -- instance Monad IO
+import GHC.IO () -- instance Monad IO
import Data.Maybe
data MVar a = MVar (MVar# RealWorld a)
@@ -71,9 +70,9 @@ newMVar value =
return mvar
-- |Return the contents of the 'MVar'. If the 'MVar' is currently
--- empty, 'takeMVar' will wait until it is full. After a 'takeMVar',
+-- empty, 'takeMVar' will wait until it is full. After a 'takeMVar',
-- the 'MVar' is left empty.
---
+--
-- There are two further important properties of 'takeMVar':
--
-- * 'takeMVar' is single-wakeup. That is, if there are multiple
@@ -133,13 +132,13 @@ tryPutMVar (MVar mvar#) x = IO $ \ s# ->
-- the MVar may have been filled (or emptied) - so be extremely
-- careful when using this operation. Use 'tryTakeMVar' instead if possible.
isEmptyMVar :: MVar a -> IO Bool
-isEmptyMVar (MVar mv#) = IO $ \ s# ->
+isEmptyMVar (MVar mv#) = IO $ \ s# ->
case isEmptyMVar# mv# s# of
(# s2#, flg #) -> (# s2#, not (flg ==# 0#) #)
-- |Add a finalizer to an 'MVar' (GHC only). See "Foreign.ForeignPtr" and
-- "System.Mem.Weak" for more about finalizers.
addMVarFinalizer :: MVar a -> IO () -> IO ()
-addMVarFinalizer (MVar m) finalizer =
+addMVarFinalizer (MVar m) finalizer =
IO $ \s -> case mkWeak# m () finalizer s of { (# s1, _ #) -> (# s1, () #) }