Detecting runnable process?

From: Philip Wernersbach
Date: Mon Oct 04 2010 - 21:42:50 EST


I'm writing some kernel code that given a task's task_struct must
decide if it is runnable, and hasn't crashed or exited. So far here's
what I've come up with:

struct task_struct *my_task;
... snip ...
if(likely(my_task != NULL && pid_alive(my_task) == true)) { return my_task; }

Is this correct?

-Phil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/