Skip to content

Commit 9bd130d

Browse files
lyakhlgirdwood
authored andcommitted
task: add a function to check if a task is active
Tasks currently have 9 states defined for them, but they all can be divided into two groups: active and passive. We define all tasks on a scheduler queue as active. All other tasks are passive. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 32b213f commit 9bd130d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • src/include/sof/schedule

src/include/sof/schedule/task.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ struct task {
7575
#endif
7676
};
7777

78+
static inline bool task_is_active(struct task *task)
79+
{
80+
switch (task->state) {
81+
case SOF_TASK_STATE_QUEUED:
82+
case SOF_TASK_STATE_PENDING:
83+
case SOF_TASK_STATE_RUNNING:
84+
case SOF_TASK_STATE_PREEMPTED:
85+
case SOF_TASK_STATE_RESCHEDULE:
86+
return true;
87+
default:
88+
return false;
89+
}
90+
}
7891

7992
static inline enum task_state task_run(struct task *task)
8093
{

0 commit comments

Comments
 (0)