[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 15:11:17 UTC 2010
The following commit has been merged in the master branch:
commit c4cef4f859532037d9cb99b90be59b6d1379af52
Author: John Goerzen <jgoerzen at complete.org>
Date: Fri Oct 13 22:51:15 2006 +0100
More doc updating
diff --git a/MissingH/ProgressTracker.hs b/MissingH/ProgressTracker.hs
index 3105f37..6ff3bae 100644
--- a/MissingH/ProgressTracker.hs
+++ b/MissingH/ProgressTracker.hs
@@ -110,7 +110,10 @@ these functions get called every time the status of the tracker changes.
This function is passed two 'ProgressStatus' records: the first
reflects the status prior to the update, and the second reflects
-the status after the update. -}
+the status after the update.
+
+Please note that the owning 'Progress' object will be locked while the
+callback is running, so the callback will not be able to make changes to it. -}
type ProgressCallback = ProgressStatus -> ProgressStatus -> IO ()
{- | The main progress status record. -}
@@ -131,6 +134,14 @@ data ProgressRecord =
newtype Progress = Progress (MVar ProgressRecord)
class ProgressStatuses a b where
+ {- | Lets you examine the 'ProgressStatus' that is contained
+ within a 'Progress' object. You can simply pass
+ a 'Progress' object and a function to 'withStatus', and
+ 'withStatus' will lock the 'Progress' object (blocking any
+ modifications while you are reading it), then pass the object
+ to your function. If you happen to already have a 'ProgressStatus'
+ object, withStatus will also accept it and simply pass it unmodified
+ to the function. -}
withStatus :: a -> (ProgressStatus -> b) -> b
class ProgressRecords a b where
@@ -193,6 +204,9 @@ newProgress' news newcb =
{- | Adds an new callback to an existing 'Progress'. The callback will be
called whenever the object's status is updated, except by the call to finishP.
+
+Please note that the Progress object will be locked while the callback is
+running, so the callback will not be able to make any modifications to it.
-}
addCallback :: Progress -> ProgressCallback -> IO ()
addCallback (Progress mpo) cb = modifyMVar_ mpo $ \po ->
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list