git.iko.soy/distributed-process
on master help sign in
Merge pull request #200 from tweag/optimization/spawnAsync
6efcbc0Alexander Vershilov
src/Control/Distributed/Process/Internal/Primitives.hs+4−1
@@ -986,7 +986,10 @@ expectTimeout n = receiveTimeout n [match return]
986spawnAsync :: NodeId -> Closure (Process ()) -> Process SpawnRef
986spawnAsync :: NodeId -> Closure (Process ()) -> Process SpawnRef
987spawnAsync nid proc = do
987spawnAsync nid proc = do
988 spawnRef <- getSpawnRef
988 spawnRef <- getSpawnRef
989+ node <- getSelfNode
990+ if nid == node
991+ then sendCtrlMsg Nothing $ Spawn proc spawnRef
989− sendCtrlMsg (Just nid) $ Spawn proc spawnRef
992+ else sendCtrlMsg (Just nid) $ Spawn proc spawnRef
990 return spawnRef
993 return spawnRef
991
994
992-- | Monitor a node (asynchronous)
995-- | Monitor a node (asynchronous)