]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - sched.c
prebuffer: Switch to the alternative post select method.
[paraslash.git] / sched.c
diff --git a/sched.c b/sched.c
index 95a07d29a0876c1ba1f737c29e36be63bc0074f1..2501b50c276ad9ec717123f945d4faa9bdd13680 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -36,7 +36,7 @@ static void unregister_task(struct task *t)
                para_strerror(-t->error));
        if (t->pre_select)
                list_del(&t->pre_select_node);
-       if (t->post_select)
+       if (t->new_post_select || t->post_select)
                list_del(&t->post_select_node);
 }
 
@@ -62,13 +62,20 @@ static void sched_preselect(struct sched *s)
 static inline void call_post_select(struct sched *s, struct task *t)
 {
 #ifndef SCHED_DEBUG
-       t->post_select(s, t);
+       if (t->new_post_select) {
+               t->error = t->new_post_select(s, t);
+               return;
+       }
+       return t->post_select(s, t);
 #else
        struct timeval t1, t2, diff;
        unsigned long pst;
 
        clock_get_realtime(&t1);
-       t->post_select(s, t);
+       if (t->new_post_select)
+               t->error = t->new_post_select(s, t);
+       else
+               t->post_select(s, t);
        clock_get_realtime(&t2);
        tv_diff(&t1, &t2, &diff);
        pst = tv2ms(&diff);
@@ -165,7 +172,10 @@ void register_task(struct sched *s, struct task *t)
                PARA_DEBUG_LOG("pre_select: %p\n", &t->pre_select);
                list_add_tail(&t->pre_select_node, &s->pre_select_list);
        }
-       if (t->post_select) {
+       if (t->new_post_select) {
+               PARA_DEBUG_LOG("post_select: %p\n", &t->new_post_select);
+               list_add_tail(&t->post_select_node, &s->post_select_list);
+       } else if ((t->post_select)) {
                PARA_DEBUG_LOG("post_select: %p\n", &t->post_select);
                list_add_tail(&t->post_select_node, &s->post_select_list);
        }