eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TimedPromise':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TimedPromise


Inheritance:

   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

Description:


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.


Class protocol:

instance creation
o  forMilliseconds: ms


Instance protocol:

accessing
o  ms: msec

accessing-parent
o  value
Note -- only good for one waiter

private
o  startup
Wait for data arrival or alarm expiry.


Examples:


     |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   


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 16 Apr 2021 10:13:09 GMT