When destroyed, it makes sure that all the tasks spawned by the current thread since its creation have finished. More...
#include <depspawn.h>
Public Member Functions | |
Observer (bool priority=true) | |
Friends | |
void | wait_for_subtasks (bool priority) |
When destroyed, it makes sure that all the tasks spawned by the current thread since its creation have finished.
A typical pattern of use for an Observer is
which makes sure that the two spawned tasks have finished before leaving the block.
depspawn::Observer::Observer | ( | bool | priority = true | ) |
Constructor
priority | if true, the observer will only collaborate in the execution of pending tasks found in the critical path since its creation. Otherwise, if it is idle because all those tasks are already running or waiting for dependencies, it can run other tasks while it waits. |
|
friend |
Waits for all the subtasks of the current task to finish
priority | if true, the thread will only execute subtasks it depends on during the wait. Otherwise, if it is idle because all those tasks are already running or waiting for dependencies, it can run other tasks while it waits. |