Closed eugeneko closed 7 months ago
This can be done with dependencies.
You create an ICompletable
with dependencies on the tasks with high priorities, and then wait on that.
I should make this into an example, along with some more documentation.
I have some troubles following your advice.
Before I call AddTaskSetToPipe
for my task, I do observerTask.SetDependency(internalTask->observerDependency_, internalTask)
.
Then I call WaitforTask(&observerTask)
when all tasks are added.
However, I get the assert when I add second task as dependency: pTaskToRunOnCompletion_->GetIsComplete()
is false, where pTaskToRunOnCompletion_
is my observerTask
. I am doing something wrong, but I struggle to see what.
Maybe I cannot add another dependency when the first dependency is already running? It's not obvious why tho.
Maybe I cannot add another dependency when the first dependency is already running?
Yes, all dependencies must be added before they are run.
This is because the first task could complete before the second task was added, causing the dependent task to complete.
I am considering an approach to add dependencies dynamically to a dependent task, but this is not yet implemented.
I am in need of something inbetween
WaitforAll()
andWaitforTask(nullptr, priority)
. In my pipeline, user code dumps a lot of tasks with highest priority and then makes sure they all completed (but not low priority background tasks!).I struggle to port this behavior to enkiTS. Any hints?