git.iko.soy/distributed-process
on master help sign in
fixup! Kill processes on a local node upon `closeLocalNode`.
d57e702Mathieu Boespflug
src/Control/Distributed/Process/Node.hs+1−1
@@ -323,6 +323,7 @@ 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 withValidLocalState (localState node) $ \vst ->
327 withValidLocalState (localState node) $ \vst ->
327 forM_ (vst ^. localProcesses) $ \lproc ->
328 forM_ (vst ^. localProcesses) $ \lproc ->
328 -- Semantics of 'throwTo' guarantee that target thread will get delivered
329 -- Semantics of 'throwTo' guarantee that target thread will get delivered
@@ -330,7 +331,6 @@ closeLocalNode node = do
330 -- that's as good as we can do. No need to wait for thread to actually
331 -- that's as good as we can do. No need to wait for thread to actually
331 -- finish dying.
332 -- finish dying.
332 killThread (processThread lproc)
333 killThread (processThread lproc)
333− modifyMVar_ (localState node) $ const $ return LocalNodeClosed
334 NT.closeEndPoint (localEndPoint node)
334 NT.closeEndPoint (localEndPoint node)
335
335
336-- | Run a process on a local node and wait for it to finish
336-- | Run a process on a local node and wait for it to finish