- if (!initialized)
- return -E_NOT_INITIALIZED;
- list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) {
- sprintf(buf, "%p", t);
- if (strcmp(id, buf))
- continue;
- t->error = -E_TASK_KILLED;
- return 1;
- }
- list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
- sprintf(buf, "%p", t);
- if (strcmp(id, buf))
- continue;
- t->error = -E_TASK_KILLED;
+/**
+ * Return the notification value of a task.
+ *
+ * \param t The task to get the notification value from.
+ *
+ * \return The notification value. If this is negative, the task has been
+ * notified by another task. Tasks are supposed to check for notifications by
+ * calling this function from their post_select method.
+ *
+ * \sa \ref task_notify().
+ */
+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->status == TS_DEAD) /* pretend dead tasks don't exist */
+ return 0;
+ if (t->status == TS_RUNNING)