@@ -28,7 +28,7 @@ module Control.Distributed.Process.Internal.Closure.BuiltIn
2828 , cpExpect
2929 , cpNewChan
3030 -- * Support for some CH operations
31− , cpDelay
31+ , cpDelayed
3232 , cpEnableTraceRemote
3333 ) where
3434
@@ -295,19 +295,20 @@ cpEnableTraceRemote =
295295-- | @delay them p@ is a process that waits for a signal (a message of type @()@)
296296-- from 'them' (origin is not verified) before proceeding as @p@. In order to
297297-- 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.
299299delay :: ProcessId -> Process () -> Process ()
300300delay them p = do
301301 ref <- monitor them
302302 let sameRef (ProcessMonitorNotification ref' _ _) = ref == ref'
303303 receiveWait [
304− match $ \() -> unmonitor ref >> p
304+ match $ \() -> unmonitor ref
305305 , matchIf sameRef $ \_ -> return ()
306306 ]
307+ p
307308
308309-- | 'CP' version of 'delay'
309−cpDelay :: ProcessId -> Closure (Process ()) -> Closure (Process ())
310−cpDelay = closureApply . cpDelay'
310+cpDelayed :: ProcessId -> Closure (Process ()) -> Closure (Process ())
311+cpDelayed = closureApply . cpDelay'
311312 where
312313 cpDelay' :: ProcessId -> Closure (Process () -> Process ())
313314 cpDelay' pid = closure decoder (encode pid)