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/07/18 10:51] – elisag | at:tutorial:actors [2007/07/18 11:21] – elisag | ||
---|---|---|---|
Line 199: | Line 199: | ||
==== Working with Unresolved Futures ==== | ==== Working with Unresolved Futures ==== | ||
- | We have yet to describe what objects can do with futures that are // | + | We have described a future as a placeholder for the return value of an asynchronous message send which is eventually // |
Blocking a thread on a future can be a major source of deadlocks, like any form of blocking, of course. In the actor paradigm where communication between actors should remain strictly asynchronous, | Blocking a thread on a future can be a major source of deadlocks, like any form of blocking, of course. In the actor paradigm where communication between actors should remain strictly asynchronous, | ||
- | The solution proposed in the [[http:// | + | The solution proposed in the [[http:// |
- | < | + | ==== Working with Resolved Futures ==== |
When a future eventually becomes resolved with a value, any messages that were accumulated by the future are forwarded asynchronously to the actual return value, such that it appears as if the original object had sent the messages to the actual return value in the first place. | When a future eventually becomes resolved with a value, any messages that were accumulated by the future are forwarded asynchronously to the actual return value, such that it appears as if the original object had sent the messages to the actual return value in the first place. | ||
Line 212: | Line 212: | ||
AmbientTalk only allows one method to be synchronously invoked on a future, the '' | AmbientTalk only allows one method to be synchronously invoked on a future, the '' | ||
</ | </ | ||
- | |||
- | ==== Working with Resolved Futures ==== | ||
As explained above, it is always correct to use asynchronous message sends to communicate with a future. Sometimes, however, we may want to perform some operation on the return value other than message sending, for example, printing it to the screen. If you print the future directly, you get the following: | As explained above, it is always correct to use asynchronous message sends to communicate with a future. Sometimes, however, we may want to perform some operation on the return value other than message sending, for example, printing it to the screen. If you print the future directly, you get the following: | ||
Line 273: | Line 271: | ||
</ | </ | ||
- | Finally, it is useful to know that '' | + | Finally, it is useful to know that '' |
< | < | ||
Line 281: | Line 279: | ||
</ | </ | ||
- | When the future for ''< | + | When the future for ''< |
==== Futures and Annotated Messages ==== | ==== Futures and Annotated Messages ==== |
at/tutorial/actors.txt · Last modified: 2020/02/05 21:26 by elisag