kill_task(): Only set task error status.
authorAndre Noll <maan@systemlinux.org>
Tue, 1 Apr 2008 19:55:26 +0000 (21:55 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 1 Apr 2008 19:55:26 +0000 (21:55 +0200)
It's not safe to call unregister_task() at this point as
this function might be called from pre_select() or post_select().
Just set the task's error value to -E_TASK_KILLED. The task
will then be unregistered on the next iteration of the
scheduler loop.

sched.c

diff --git a/sched.c b/sched.c
index 5f7babe..2500406 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -236,7 +236,6 @@ int kill_task(char *id)
                if (strcmp(id, buf))
                        continue;
                t->error = -E_TASK_KILLED;
-               unregister_task(t);
                return 1;
        }
        list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
@@ -244,7 +243,6 @@ int kill_task(char *id)
                if (strcmp(id, buf))
                        continue;
                t->error = -E_TASK_KILLED;
-               unregister_task(t);
                return 1;
        }
        return -E_NO_SUCH_TASK;