git.iko.soy/distributed-process
on master help sign in
Properly set LocalNodeClosed as originally intended.
2957cbaMathieu Boespflug
src/Control/Distributed/Process/Node.hs+10−8
@@ -323,14 +323,16 @@ startServiceProcesses node = do
323-- | Force-close a local node, killing all processes on that node.
323-- | Force-close a local node, killing all processes on that node.
324closeLocalNode :: LocalNode -> IO ()
324closeLocalNode :: LocalNode -> IO ()
325closeLocalNode node = do
325closeLocalNode node = do
326− modifyMVar_ (localState node) $ const $ return LocalNodeClosed
326+ modifyMVar_ (localState node) $ \st -> case st of
327− withValidLocalState (localState node) $ \vst ->
327+ LocalNodeValid vst -> do
328− forM_ (vst ^. localProcesses) $ \lproc ->
328+ forM_ (vst ^. localProcesses) $ \lproc ->
329− -- Semantics of 'throwTo' guarantee that target thread will get delivered
329+ -- Semantics of 'throwTo' guarantee that target thread will get
330− -- an exception. Therefore, target thread will be killed eventually and
330+ -- delivered an exception. Therefore, target thread will be killed
331− -- that's as good as we can do. No need to wait for thread to actually
331+ -- eventually and that's as good as we can do. No need to wait for
332− -- finish dying.
332+ -- thread to actually finish dying.
333− killThread (processThread lproc)
333+ killThread (processThread lproc)
334+ return LocalNodeClosed
335+ LocalNodeClosed -> return LocalNodeClosed
334 NT.closeEndPoint (localEndPoint node)
336 NT.closeEndPoint (localEndPoint node)
335
337
336-- | Run a process on a local node and wait for it to finish
338-- | Run a process on a local node and wait for it to finish