Support taskiter by allowing tasks to re-launch

This commit is contained in:
David Alvarez 2023-04-14 09:46:36 +02:00 committed by Rodrigo Arias Mallo
parent ff2f33abb9
commit 26d01d18eb

View File

@ -70,12 +70,12 @@ task_execute(struct task_stack *stack, struct task *task)
return -1; return -1;
} }
if (task->state != TASK_ST_CREATED) { if (task->state != TASK_ST_CREATED && task->state != TASK_ST_DEAD) {
err("cannot execute task %u: state is not created", task->id); err("cannot execute task %u: state is not created or dead", task->id);
return -1; return -1;
} }
if (task->thread != NULL) { if (task->thread != NULL && task->state != TASK_ST_DEAD) {
err("task already has a thread assigned"); err("task already has a thread assigned");
return -1; return -1;
} }