Closed liamhauw closed 4 months ago
Hi!
Does this mean that the task_scheduler is initialized with a thread number of 0, and the threads responsible for executing the tasks range from 1 to 3?
Yes, this is correct.
But why are some of the tasks I execute appearing on thread 0?
Thread 0, the thread the task scheduler is initialized on, can use the enkiTS
task API, and will run tasks under several circumstances:
AddTaskSetToPipe
and the pipe is full, enkiTS
will run a range of the taskset. See #58 for a discussion of this, along with how to avoid it by using a task to launch multiple tasks rather than doing so from the main thread.Waitfor*
API call is made, enkiTS will run tasks whilst waiting. See the comments for more details.RunPinnedTasks
is called, the main thread will run any tasks which have been pinned to thread 0.Does that help clarify the behaviour for you?
Thank! It's very helpful to me.
When I initialize enki::TaskScheduler as follows:
Does this mean that the task_scheduler is initialized with a thread number of 0, and the threads responsible for executing the tasks range from 1 to 3?
But why are some of the tasks I execute appearing on thread 0?