git.iko.soy/distributed-process
on master help sign in
Use usend to implement spawn. (#297)

This avoids the need to create a connection from the spawner to the spawned process when spawning.

commit1b2469865a34f7c9c15dc0727da4600b8da9ae5c authorFacundo Domínguez <facundominguez@gmail.com> dateFri 26 Aug 2016, 16:59 (10 years ago) parent6935b52
1 file changed+3−3
src/Control/Distributed/Process/Internal/Spawn.hs+3−3
src/Control/Distributed/Process/Internal/Spawn.hs+3−3
@@ -43,7 +43,7 @@ import Control.Distributed.Process.Internal.Closure.BuiltIn
4343 )
4444import Control.Distributed.Process.Internal.Primitives
4545 ( -- Basic messaging
46− send
46+ usend
4747 , expect
4848 , receiveWait
4949 , match
@@ -71,7 +71,7 @@ spawn nid proc = do
7171 receiveWait [
7272 matchIf (\(DidSpawn ref _) -> ref == sRef) $ \(DidSpawn _ pid) -> do
7373 unmonitor mRef
74− send pid ()
74+ usend pid ()
7575 return pid
7676 , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef) $ \_ ->
7777 return (nullProcessId nid)
@@ -118,7 +118,7 @@ call dict nid proc = do
118118 cpDelayed us (returnCP sdictUnit ())
119119 )
120120 mResult <- receiveWait
121− [ match $ \a -> send pid () >> return (Right a)
121+ [ match $ \a -> usend pid () >> return (Right a)
122122 , matchIf (\(ProcessMonitorNotification ref _ _) -> ref == mRef)
123123 (\(ProcessMonitorNotification _ _ reason) -> return (Left reason))
124124 ]