@@ -28,7 +28,7 @@ module Control.Distributed.Process.Internal.Closure.BuiltIn
28 , cpExpect
28 , cpExpect
29 , cpNewChan
29 , cpNewChan
30 -- * Support for some CH operations
30 -- * Support for some CH operations
31− , cpDelay
31+ , cpDelayed
32 , cpEnableTraceRemote
32 , cpEnableTraceRemote
@@ -295,19 +295,20 @@ cpEnableTraceRemote =
295-- | @delay them p@ is a process that waits for a signal (a message of type @()@)
295-- | @delay them p@ is a process that waits for a signal (a message of type @()@)
296-- from 'them' (origin is not verified) before proceeding as @p@. In order to
296-- from 'them' (origin is not verified) before proceeding as @p@. In order to
297-- avoid waiting forever, @delay them p@ monitors 'them'. If it receives a
297-- avoid waiting forever, @delay them p@ monitors 'them'. If it receives a
298−-- monitor message instead it simply terminates.
298+-- monitor message instead, it proceeds as @p@ too.
299delay :: ProcessId -> Process () -> Process ()
299delay :: ProcessId -> Process () -> Process ()
300delay them p = do
300delay them p = do
301 ref <- monitor them
301 ref <- monitor them
302 let sameRef (ProcessMonitorNotification ref' _ _) = ref == ref'
302 let sameRef (ProcessMonitorNotification ref' _ _) = ref == ref'
303 receiveWait [
303 receiveWait [
304− match $ \() -> unmonitor ref >> p
304+ match $ \() -> unmonitor ref
305 , matchIf sameRef $ \_ -> return ()
305 , matchIf sameRef $ \_ -> return ()
308-- | 'CP' version of 'delay'
309-- | 'CP' version of 'delay'
309−cpDelay :: ProcessId -> Closure (Process ()) -> Closure (Process ())
310+cpDelayed :: ProcessId -> Closure (Process ()) -> Closure (Process ())
310−cpDelay = closureApply . cpDelay'
311+cpDelayed = closureApply . cpDelay'
312 cpDelay' :: ProcessId -> Closure (Process () -> Process ())
313 cpDelay' :: ProcessId -> Closure (Process () -> Process ())
313 cpDelay' pid = closure decoder (encode pid)
314 cpDelay' pid = closure decoder (encode pid)