unregister_task(): Set error status to E_TASK_UNREGISTERED
authorAndre Noll <maan@systemlinux.org>
Tue, 1 Apr 2008 19:57:33 +0000 (21:57 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 1 Apr 2008 19:57:33 +0000 (21:57 +0200)
This way the users know when it's safe to free the memory
containing the task struct.

error.h
sched.c

diff --git a/error.h b/error.h
index 6b8403d..c2f993d 100644 (file)
--- a/error.h
+++ b/error.h
@@ -166,6 +166,7 @@ extern const char **para_errlist[];
 
 #define SCHED_ERRORS \
        PARA_ERROR(TASK_KILLED, "task killed"), \
+       PARA_ERROR(TASK_UNREGISTERED, "task has been unscheduled"), \
        PARA_ERROR(NO_SUCH_TASK, "task not found"), \
        PARA_ERROR(NOT_INITIALIZED, "scheduler not yet initialized"), \
 
diff --git a/sched.c b/sched.c
index 2500406..b9d6428 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -41,8 +41,7 @@ void unregister_task(struct task *t)
                list_del(&t->pre_select_node);
        if (t->post_select)
                list_del(&t->post_select_node);
-       if (t->error >= 0)
-               t->error = -E_TASK_KILLED;
+       t->error = -E_TASK_UNREGISTERED;
 };