join
Description:
[ Version ( since = "0.3.0-alpha" ) ]
public G[] join<G> (owned TaskFunc<G> left, owned TaskFunc<G> right) throws Error
Runs the subtasks and returns the results.
Submits the left task to the executor first, runs the right task in the current thread, and waits for them to complete.
This method uses the executor of the common task env.
int fibonacci (int n) {
if (n <= 1) {
return n;
} else {
// Note. Not 'int' but 'int?' (boxed value type)
var (left, right) = join<int?>( () => fibonacci(n-1),
() => fibonacci(n-2) );
return left + right;
}
}
Parameters:
left |
the left task |
right |
the right task |
Returns:
(left-result, right-result) An array containing the two results. |
Exceptions:
Error |
the error thrown by the subtasks |
See also:
Namespace: Gpseq
Package: gpseq-1.0