Synchronous scopes, joined on the thread that created them, and Join.
template<typename A, typename B>
| void donner::tasks::Join |
( |
TaskScheduler & | scheduler, |
|
|
A && | a, |
|
|
B && | b ) |
Runs a and b, possibly in parallel, and returns when both have finished.
On a worker, b is pushed to the worker's deque and a runs on the calling thread; the wait then takes b back and runs it if no other worker stole it, and otherwise waits for it as a TaskScope's creator does. On an adopted thread it also takes back its local second branch. An ordinary non-worker spawns b to the scheduler's global queue, a runs on the calling thread, and the call then waits for b as a TaskScope does; it cannot take b back. With zero workers, a runs and then b, both on the calling thread.
- Parameters
-
| scheduler | The scheduler that runs b. |
| a | Runs on the calling thread. |
| b | Runs on a worker, or inline when the scheduler cannot queue it. |