X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=sched.c;h=b9d642864624cd796e3853331cc9a652378c41c5;hp=5d4901df265e4b256bb4558382e7d4a5cb6b905f;hb=e6940831fbcf21dd0e6243ca89ea0c7f8b195d9e;hpb=e9a616c1db74000aad69a619d49435c8a0465727 diff --git a/sched.c b/sched.c index 5d4901df..b9d64286 100644 --- 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; }; @@ -50,7 +49,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 +71,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 +173,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; @@ -235,7 +235,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) { @@ -243,7 +242,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;