Add FIXME notice for taskiter support

Set the task->thread to NULL if we re-execute a task from the Dead
state, so it follows the behavior of a Created task.
This commit is contained in:
Rodrigo Arias 2023-04-14 11:08:54 +02:00 committed by Rodrigo Arias Mallo
parent 3c6c6ed230
commit 49f915fda5

View File

@ -70,12 +70,17 @@ task_execute(struct task_stack *stack, struct task *task)
return -1;
}
if (task->state != TASK_ST_CREATED && task->state != TASK_ST_DEAD) {
/* FIXME: To support the taskiter we need to transition from Dead to
* Running again. For now we allow the transition until we have a proper
* task state event. */
if (task->state == TASK_ST_DEAD) {
task->thread = NULL;
} else if (task->state != TASK_ST_CREATED) {
err("cannot execute task %u: state is not created or dead", task->id);
return -1;
}
if (task->thread != NULL && task->state != TASK_ST_DEAD) {
if (task->thread != NULL) {
err("task already has a thread assigned");
return -1;
}