Skip to content

Commit 6efcbc0

Browse files
committed
Merge pull request #200 from tweag/optimization/spawnAsync
Optimization: do not use network transport for local spawnAsync.
2 parents 07dbb9b + f47c085 commit 6efcbc0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Control/Distributed/Process/Internal/Primitives.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,10 @@ expectTimeout n = receiveTimeout n [match return]
986986
spawnAsync :: NodeId -> Closure (Process ()) -> Process SpawnRef
987987
spawnAsync nid proc = do
988988
spawnRef <- getSpawnRef
989-
sendCtrlMsg (Just nid) $ Spawn proc spawnRef
989+
node <- getSelfNode
990+
if nid == node
991+
then sendCtrlMsg Nothing $ Spawn proc spawnRef
992+
else sendCtrlMsg (Just nid) $ Spawn proc spawnRef
990993
return spawnRef
991994

992995
-- | Monitor a node (asynchronous)

0 commit comments

Comments
 (0)