git.iko.soy/distributed-process
on master help sign in
Prepare for changing withMonitor.

Add warning message, add withMonitor_ function for future compatibility.

commit6c0465353472625a2561a3ca3d3ea881e92a5bc5 authorAlexander Vershilov <alexander.vershilov@gmail.com> dateFri 11 Mar 2016, 02:04 (11 years ago) parent6f77480
2 files changed+12−13
src/Control/Distributed/Process.hs+2−2 src/Control/Distributed/Process/Internal/Primitives.hs+10−11
src/Control/Distributed/Process.hs+2−2
@@ -102,7 +102,7 @@ module Control.Distributed.Process
102102 , monitorPort
103103 , unmonitor
104104 , withMonitor
105− , withMonitorRef
105+ , withMonitor_
106106 , MonitorRef -- opaque
107107 , ProcessLinkException(..)
108108 , NodeLinkException(..)
@@ -270,7 +270,7 @@ import Control.Distributed.Process.Internal.Primitives
270270 , monitorPort
271271 , unmonitor
272272 , withMonitor
273− , withMonitorRef
273+ , withMonitor_
274274 -- Logging
275275 , say
276276 -- Registry
src/Control/Distributed/Process/Internal/Primitives.hs+10−11
@@ -77,7 +77,7 @@ module Control.Distributed.Process.Internal.Primitives
7777 , monitor
7878 , unmonitor
7979 , withMonitor
80− , withMonitorRef
80+ , withMonitor_
8181 -- * Logging
8282 , say
8383 -- * Registry
@@ -888,20 +888,19 @@ monitor = monitor' . ProcessIdentifier
888888-- messages in the queue.
889889--
890890withMonitor :: ProcessId -> Process a -> Process a
891−withMonitor pid = withMonitorRef pid . const
892− -- unmonitor blocks waiting for the response, so there's a possibility
893− -- that an exception might interrupt withMonitor before the unmonitor
894− -- has completed. I think that's better than making the unmonitor
895− -- uninterruptible.
891+withMonitor pid = bracket (monitor pid) unmonitor . const
892+{-# WARNING withMonitor "Signature of this function will be changed to 'ProcessId -> (MonitorRef -> Process a) -> Process a' in the next release, for stable behaviour use withMonitor_" #-}
896893
897894-- | Establishes temporary monitoring of another process.
898895--
899−-- @withMonitorRef pid code@ sets up monitoring of @pid@ for the duration
900−-- of @code@. Note: although monitoring is no longer active when
901−-- @withMonitorRef@ returns, there might still be unreceived monitor
896+-- @withMonitor_ pid code@ sets up monitoring of @pid@ for the duration
897+-- of @code@. Note: although monitoring is no longer active when
898+-- @withMonitor_@ returns, there might still be unreceived monitor
902899-- messages in the queue.
903−withMonitorRef :: ProcessId -> (MonitorRef -> Process a) -> Process a
904−withMonitorRef pid code = bracket (monitor pid) unmonitor code
900+--
901+-- Since 0.6.1
902+withMonitor_ :: ProcessId -> Process a -> Process a
903+withMonitor_ = withMonitor
905904
906905-- | Remove a link
907906--