at:tutorial:actors
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
at:tutorial:actors [2007/04/07 17:36] – tvcutsem | at:tutorial:actors [2007/04/07 18:30] – tvcutsem | ||
---|---|---|---|
Line 254: | Line 254: | ||
</ | </ | ||
- | The '' | + | The '' |
< | < | ||
Line 263: | Line 263: | ||
>> | >> | ||
</ | </ | ||
+ | |||
+ | Finally, it is useful to know that '' | ||
+ | |||
+ | < | ||
+ | def fut := when: calculator< | ||
+ | calculator< | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | When the future for ''< | ||
=== Futures and Striped Messages === | === Futures and Striped Messages === | ||
- | Explain: | + | As previously explained, there are two modes for enabling futures in AmbientTalk. Invoking '' |
- | '' | + | |
- | '' | + | When a message send is striped with the '' |
+ | |||
+ | < | ||
+ | o<-m()@OneWayMessage | ||
+ | </ | ||
+ | |||
+ | When a message send is striped with the '' | ||
+ | |||
+ | < | ||
+ | o<-m()@FutureMessage | ||
+ | </ | ||
+ | |||
+ | Finally, it is possible to first invoke '' | ||
=== Conditional Synchronisation with Futures === | === Conditional Synchronisation with Futures === | ||
- | explain: explicit | + | Futures are useful to synchronise on the return value of an asynchronous message send. However, objects hosted by different actors may often want to synchronise based on other events or conditions. In such cases, |
+ | |||
+ | < | ||
+ | def [future, resolver] := makeFuture(); | ||
+ | consumer< | ||
+ | def val := /* calculate useful value */ | ||
+ | resolver.resolve(val); | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The resolver also defines a '' | ||
==== Actor Mirrors ==== | ==== Actor Mirrors ==== |
at/tutorial/actors.txt · Last modified: 2020/02/05 21:26 by elisag