chp 1.0.0 → 1.0.1
raw patch · 4 files changed
+32/−17 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Control/Concurrent/CHP.hs +4/−0
- Control/Concurrent/CHP/Alt.hs +13/−7
- Control/Concurrent/CHP/Traces/Base.hs +6/−7
- chp.cabal +9/−3
Control/Concurrent/CHP.hs view
@@ -39,6 +39,10 @@ -- * "Control.Concurrent.CHP.Traces" -- -- * "Control.Concurrent.CHP.Utils"+--+-- For an overview of the library, take a look at the CHP tutorial:+-- <http://www.cs.kent.ac.uk/projects/ofa/chp/tutorial.pdf> available from+-- the main CHP website: <http://www.cs.kent.ac.uk/projects/ofa/chp/> module Control.Concurrent.CHP ( module Control.Concurrent.CHP.Alt, module Control.Concurrent.CHP.Barriers,
Control/Concurrent/CHP/Alt.hs view
@@ -241,17 +241,23 @@ = do earliestReady <- liftIO $ atomically checkNormalGuards tv <- liftIO . atomically $ newTVar Nothing pid <- getProcessId- mn <- liftIO . atomically $ enableEvents tv pid- (maybe id take earliestReady eventGuards)- (isNothing earliestReady)+ (_, tr) <- get+ mn <- liftIO . atomically $ do+ ret <- enableEvents tv pid+ (maybe id take earliestReady eventGuards)+ (isNothing earliestReady)+ case ret of+ Just ((e,_), pids, _) ->+ do recordEventLast e (Set.fromList pids) tr+ return ret+ Nothing -> return ret case (mn, earliestReady) of -- An event -- and we were the last person to arrive: -- The event must have been higher priority than any other -- ready guards- (Just (rec, pids, ns), _) ->- recordEventLast (fst rec) (Set.fromList pids)- >> recordEvent (snd rec)- >> storeChoice ns+ (Just (rec, _, ns), _) ->+ do recordEvent (snd rec)+ storeChoice ns -- No events were ready, but there was an available normal -- guards. Re-run the normal guards; at least one will be ready (Nothing, Just _) ->
Control/Concurrent/CHP/Traces/Base.hs view
@@ -116,15 +116,14 @@ deriving (Eq, Ord) -- | Records an event where you were the last person to engage in the event-recordEventLast :: Maybe RecordedEvent -> Set.Set ProcessId -> TraceT IO ()-recordEventLast Nothing _ = return ()-recordEventLast (Just e) otherPids- = do (x,y) <- get- case (x, y) of- ( _, Trace (_,_,CSPTraceRev tv)) -> liftIO $ atomically $+recordEventLast :: Maybe RecordedEvent -> Set.Set ProcessId -> TraceStore -> STM ()+recordEventLast Nothing _ _ = return ()+recordEventLast (Just e) otherPids y+ = case y of+ Trace (_,_,CSPTraceRev tv) -> do t <- readTVar tv writeTVar tv $! addRLE e t- (_, Trace (pid, _, VCRTraceRev tv)) -> liftIO $ atomically $ do+ Trace (pid, _, VCRTraceRev tv) -> do t <- readTVar tv let pidSet = Set.insert pid otherPids t' = case t of
chp.cabal view
@@ -1,6 +1,6 @@ Name: chp-Version: 1.0.0-Synopsis: Communicating Haskell Processes: an implementation of concurrency ideas from Communicating Sequential Processes+Version: 1.0.1+Synopsis: An implementation of concurrency ideas from Communicating Sequential Processes License: BSD3 License-file: LICENSE Author: Neil Brown@@ -8,7 +8,13 @@ Copyright: Copyright (c) 2008, University of Kent Stability: Provisional Tested-with: GHC==6.8.2-Description: Requires at least GHC 6.8.1+Description: The Communicating Haskell Processes (CHP) library is an+ implementation of ideas from Hoare's Communicating+ Sequential Processes. More details and a tutorial can be+ found at its homepage:+ <http://www.cs.kent.ac.uk/projects/ofa/chp/>+ The library requires at least GHC 6.8.1.+Homepage: http://www.cs.kent.ac.uk/projects/ofa/chp/ Category: Concurrency Build-Type: Simple