From 0a16b4135c0d9310e098ab6655a4dd2ed3461757 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Sat, 16 Jan 1999 16:06:17 +0000 Subject: [PATCH] [project @ 1999-01-16 16:06:17 by sof] Documented isEmptyMVar --- ghc/docs/libraries/Concurrent.sgml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ghc/docs/libraries/Concurrent.sgml b/ghc/docs/libraries/Concurrent.sgml index 4a8aa9df4151..1ea694871d77 100644 --- a/ghc/docs/libraries/Concurrent.sgml +++ b/ghc/docs/libraries/Concurrent.sgml @@ -22,8 +22,10 @@ takeMVar :: MVar a -> IO a putMVar :: MVar a -> a -> IO () swapMVar :: MVar a -> a -> IO a readMVar :: MVar a -> IO a +isEmptyMVar :: MVar a -> IO Bool instance Eq (MVar a) + data Chan a -- channels newChan :: IO (Chan a) writeChan :: Chan a -> a -> IO () @@ -97,4 +99,16 @@ its children before exiting. The <tt/Ord/ instance for <tt/ThreadId/s provides an arbitrary total ordering which might be used to build an ordered binary tree, say. +<item> +The operation <tt/isEmptyMVar/ returns a flag indicating +whether the <tt/MVar/ is currently empty or filled in, i.e., +will a thread block when performing a <tt/takeMVar/ on that +<tt/MVar/ or not? + +Please notice that the Boolean value returned from <tt/isEmptyMVar/ +represent just a snapshot of the state of the <tt/MVar/. By the +time a thread gets to inspect the result and act upon it, other +threads may have accessed the <tt/MVar/ and changed its 'filled-in' +status of the variable. Please be wary of this. + </itemize> -- GitLab