sched: Only call pre/post select hooks if tasks are not in error state.
authorAndre Noll <maan@systemlinux.org>
Mon, 31 Mar 2008 20:35:06 +0000 (22:35 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 31 Mar 2008 20:35:06 +0000 (22:35 +0200)
sched.c

diff --git a/sched.c b/sched.c
index 5d4901d..5f7babe 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -50,7 +50,8 @@ static void sched_preselect(struct sched *s)
 {
        struct task *t, *tmp;
        list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) {
-               t->pre_select(s, t);
+               if (t->error >= 0)
+                       t->pre_select(s, t);
 //             PARA_INFO_LOG("%s \n", t->status);
                if (t->error >= 0)
                        continue;
@@ -71,7 +72,8 @@ static void sched_post_select(struct sched *s)
        struct task *t, *tmp;
 
        list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
-               t->post_select(s, t);
+               if (t->error >= 0)
+                       t->post_select(s, t);
 //             PARA_INFO_LOG("%s: %d\n", t->status, t->ret);
                if (t->error >= 0)
                        continue;
@@ -172,7 +174,6 @@ void sched_shutdown(void)
                return;
        list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node)
                unregister_task(t);
-       /* remove tasks which do not have a pre_select hook */
        list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node)
                unregister_task(t);
        initialized = 0;