|
Class: TimedPromise
Object
|
+--Promise
|
+--TimedPromise
- Package:
- stx:libbasic2
- Category:
- Kernel-Processes
- Version:
- rev:
1.4
date: 2018/04/10 07:51:23
- user: stefan
- file: TimedPromise.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
A TimedPromise is a Promise with a timeout.
An attempt to read the value of a TimedPromise will wait until the process has finished computing it
or the specified timeout expires.
If the process terminates with an exception, an attempt to read the value of the TimedPromise will raise the same exception.
In case of a timeout the OsNeedRetryError will be raised.
instance creation
-
forMilliseconds: ms
-
accessing
-
ms: msec
-
accessing-parent
-
value
-
Note -- only good for one waiter
private
-
startup
-
Wait for data arrival or alarm expiry.
|p|
p := TimedPromise forMilliseconds:1000.
p value:[10000 factorial] priority:Processor activePriority.
Transcript showCR:'doing something else'.
p value
|
|p|
p := TimedPromise forMilliseconds:1000.
p value:[1000 factorial] priority:Processor activePriority.
Transcript showCR:'doing something else'.
p value
|
|p|
p := TimedPromise forMilliseconds:1000.
p value:[1000 factorial. ZeroDivide raise] priority:Processor activePriority.
Transcript showCR:'doing something else'.
p value
|
|