@@ -138,6 +138,9 @@ main = do
138
138
-- Die immediately - throws a ProcessExitException with the given reason.
139
139
Nothing -> die "nothing came back!"
140
140
Just s -> say $ "got " ++ s ++ " back!"
141
+
142
+ -- Without the following delay, the process sometimes exits before the messages are exchanged.
143
+ liftIO $ threadDelay 2000000
141
144
{% endhighlight %}
142
145
143
146
Note that we've used ` receiveWait ` this time around to get a message.
@@ -198,7 +201,7 @@ not depend on any runtime arguments). The type of static actions in Cloud
198
201
Haskell is ` Closure (Process a) ` . More generally, a value of type ` Closure b `
199
202
is a value that was constructed explicitly as the composition of symbolic
200
203
pointers and serializable values. Values of type ` Closure b ` are serializable,
201
- even if values of type ` b ` might not. For instance, while we can't in general
204
+ even if values of type ` b ` might not be . For instance, while we can't in general
202
205
send actions of type ` Process () ` , we can construct a value of type `Closure
203
206
(Process ())` instead, containing a symbolic name for the action, and send
204
207
that instead. So long as the remote end understands the same meaning for the
@@ -218,7 +221,7 @@ For curried functions, you'll need to uncurry them first (i.e. "tuple up" the
218
221
arguments). However, to ensure that the remote side can adequately interpret
219
222
the resulting ` Closure ` , you'll need to add a mapping in a so-called * remote
220
223
table* associating the symbolic name of a function to its value. Processes can
221
- only be successfully spawned on remote nodes of all these remote nodes have
224
+ only be successfully spawned on remote nodes if all these remote nodes have
222
225
the same remote table as the local one.
223
226
224
227
We need to configure our remote table (see the [ API reference] [ 6 ] for
@@ -278,8 +281,8 @@ In the above example, we spawn `sampleTask` on node `us` in two
278
281
different ways:
279
282
280
283
* using ` spawn ` , which expects some node identifier to spawn a process
281
- on along for the action of the process.
282
- * using ` spawnLocal ` , a specialization of ` spawn ` to the case when the
284
+ on along with a ` Closure ` for the action of the process.
285
+ * using ` spawnLocal ` , a specialization of ` spawn ` for the case when the
283
286
node identifier actually refers to the local node (i.e. ` us ` ). In
284
287
this special case, no serialization is necessary, so passing an
285
288
action directly rather than a ` Closure ` works just fine.
0 commit comments