|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 6-Feb-2009 Edit History|
The wait function will accept a single port:
or, an entire block of ports can be provided:
wait [port1 port2 port3]
In addition, a timeout value can be provided as a number of seconds or as a time value:
wait [port1 port2 10] wait [port1 port2 0:00:05]
The first example will time out in ten seconds. The second example will timeout in five seconds.
ready: wait [port1 port2 10] if ready [data: copy ready]
The above example will read data from the first ready port if a timeout did not occur.
To obtain a block of all ports that are ready, use the /all refinement.
ready: wait/all [port1 port2 10] if ready [ foreach port ready [ append data copy port ] ]
This example would append data from all ready ports into a single series.
dispatch [ port1 [print "port1 awake"] port2 [print "port2 awake"] 10 [print "timeout!"] ]
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|