\"\" \"\" \"\"
Go up to Selectors
Go forward to Size(): Size of a Thread Bag
RISC-Linz logo

Wait(): Returning the Bag Results

r = Wait(b, i)
r = Wait(b, i, &d)
      R r
      ThreadBag<R> b
      int i
      int d

Specification: Returns the result r with index i from bag b. In the second form, d is set to 1 if an object with such an index exists and 0 else. The first result has index 0.

The index ordering of thread results is unspecified apart from the following constraint (n is the number of threads in b):

If Wait(b, i) blocks forever (because the corresponding thread ti never terminates), then also each thread tj with i<j<n will never terminate provided that tj has been started with start.

Constraints: It is illegal to apply Wait to an unbound handle b. It is illegal to apply Wait to some i less than zero. In the first form, it is illegal to apply Wait to some i larger than Size(b)-1.

Complexity:

Implementation: The thread result with index i is the (i+1)-th result that has been computed i.e. the index ordering reflects the order in which threads have terminated and delivered their results. A thread waiting on thread result i is therefore blocked until i+1 threads have terminated.
Author: Wolfgang Schreiner
Last Modification: April 12, 1997