git.iko.soy/distributed-process
on master help sign in
actually hide ProcessKillException - we do not want anyone to be able

to catch one of these and override the behaviour of `kill'

commit8d4eeb2106399a3f5c5f5a77f79ae3d6da804544 authorTim Watson <tim@rabbitmq.com> dateWed 16 Jan 2013, 23:24 (14 years ago) parentd9cd546
2 files changed+11−12
distributed-process/src/Control/Distributed/Process/Internal/Primitives.hs−11 distributed-process/src/Control/Distributed/Process/Node.hs+11−1
distributed-process/src/Control/Distributed/Process/Internal/Primitives.hs−11
@@ -26,7 +26,6 @@ module Control.Distributed.Process.Internal.Primitives
2626 , terminate
2727 , ProcessTerminationException(..)
2828 , kill
29− , ProcessKillException(..)
3029 , exit
3130 , catchExit
3231 , ProcessExitException(..)
@@ -355,16 +354,6 @@ kill :: ProcessId -> String -> Process ()
355354-- 'monitor' or 'link' request.
356355kill them reason = sendCtrlMsg Nothing (Kill them reason)
357356
358−-- | Thrown by 'kill'
359−data ProcessKillException =
360− ProcessKillException !ProcessId !String
361− deriving (Typeable)
362−
363−instance Exception ProcessKillException
364−instance Show ProcessKillException where
365− show (ProcessKillException pid reason) =
366− "killed-by=" ++ show pid ++ ",reason=" ++ reason
367−
368357-- | Graceful request to exit a process
369358exit :: Serializable a => ProcessId -> a -> Process ()
370359-- NOTE: We send the message to our local node controller, which will then
distributed-process/src/Control/Distributed/Process/Node.hs+11−1
@@ -152,7 +152,6 @@ import Control.Distributed.Process.Internal.Primitives
152152 , receiveWait
153153 , match
154154 , sendChan
155− , ProcessKillException(..)
156155 , ProcessExitException(..)
157156 )
158157import Control.Distributed.Process.Internal.Types
@@ -481,6 +480,17 @@ initNCState = NCState { _links = Map.empty
481480 , _registeredOnNodes = Map.empty
482481 }
483482
483+-- | Thrown in response to the user invoking 'kill' (see Primitives.hs). This
484+-- type is deliberately not exported so it cannot be caught explicitly.
485+data ProcessKillException =
486+ ProcessKillException !ProcessId !String
487+ deriving (Typeable)
488+
489+instance Exception ProcessKillException
490+instance Show ProcessKillException where
491+ show (ProcessKillException pid reason) =
492+ "killed-by=" ++ show pid ++ ",reason=" ++ reason
493+
484494--------------------------------------------------------------------------------
485495-- Core functionality --
486496--------------------------------------------------------------------------------