git.iko.soy/distributed-process
on master help sign in
Merge pull request #185 from tweag/DP-105
07dbb9bAlexander Vershilov
src/Control/Distributed/Process/Node.hs+3−1
@@ -1136,7 +1136,9 @@ postMessage pid msg = do
1136throwException :: Exception e => ProcessId -> e -> NC ()
1136throwException :: Exception e => ProcessId -> e -> NC ()
1137throwException pid e = do
1137throwException pid e = do
1138 node <- ask
1138 node <- ask
1139+ -- throwTo blocks until the exception is received by the target thread.
1140+ -- We fork a helper thread to avoid blocking the node controller.
1139− liftIO $ withLocalProc node pid $ \p -> throwTo (processThread p) e
1141+ liftIO $ withLocalProc node pid $ \p -> void $ forkIO $ throwTo (processThread p) e
1140
1142
1141withLocalProc :: LocalNode -> ProcessId -> (LocalProcess -> IO ()) -> IO ()
1143withLocalProc :: LocalNode -> ProcessId -> (LocalProcess -> IO ()) -> IO ()
1142withLocalProc node pid p =
1144withLocalProc node pid p =