X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=sched.c;h=fb0d4d63eacda82cb4e0779d72daa56c2634a324;hb=ba0c0797c76a2c94cb4a9f6938274fea5ba0226f;hp=1b83b704fb48599d7c44ba540bc90b90e040be9b;hpb=5254df7e470dc49a29f91fa8185b98c40246f5ea;p=paraslash.git diff --git a/sched.c b/sched.c index 1b83b704..fb0d4d63 100644 --- a/sched.c +++ b/sched.c @@ -315,6 +315,25 @@ int task_get_notification(const struct task *t) return t->notification; } +/** + * Return the status value of a task. + * + * \param t The task to get the status value from. + * + * \return Zero if task does not exist, one if task is running, negative error + * code if task has terminated. + */ +int task_status(const struct task *t) +{ + if (!t) + return 0; + if (t->dead) + return 0; + if (t->error >= 0) + return 1; + return t->error; +} + /** * Set the notification value of all tasks of a scheduler instance. *