Function concore::v1::spawn(task&&, bool)¶
Defined in File spawn.hpp
Function Documentation¶
-
void
concore::v1::spawn(task &&t, bool wake_workers = true)¶ Spawns a task, hopefully in the current working thread.
This is intended to be called from within a task. In this case, the task will be added to the list of tasks for the current worker thread. The tasks will be added in the front of the list, so it will be executed in front of others.
- Parameters
t: The task to be spawnedwake_workers: True if we should wake other workers for this task
The add-to-front strategy aims as improving locality of execution. We assume that this task is closer to the current task than other tasks in the system.
If the current running task does not finish execution after spawning this new task, it’s advised for the
wake_workersparameter to be set totrue. If, on the other hand, the current task finishes execution after this, it may be best to not setwake_workerstofalseand thus try to wake other threads. Waking up other threads can be an efficiency loss that we don’t need if we know that this thread is finishing soon executing the current task.Note that the given task ca take a task_group at construction. This way, the users can control the groups of the spawned tasks.