X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=sched.c;h=65176bd91a875ab16ce07194299dbc9bde5a00a5;hb=3d6ca6e3ae198017164e544c59d622b11a5afdde;hp=4e989d34109a0d1f904b01928c3285e773d9aa8f;hpb=86611501af20b6b3eee45ac39a1daa7d50ada231;p=paraslash.git diff --git a/sched.c b/sched.c index 4e989d34..65176bd9 100644 --- a/sched.c +++ b/sched.c @@ -7,7 +7,6 @@ /** \file sched.c Paraslash's scheduling functions. */ #include -#include /* readdir() */ #include #include @@ -93,7 +92,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) { - call_post_select(s, t); + if (t->error >= 0) + call_post_select(s, t); // PARA_INFO_LOG("%s: %d\n", t->status, t->ret); if (t->error >= 0) continue; @@ -302,17 +302,19 @@ void sched_request_timeout_ms(long unsigned ms, struct sched *s) * \param barrier Absolute time before select() should return. * \param s Pointer to the scheduler struct. * - * If \a barrier is in the past, this function does nothing. + * \return If \a barrier is in the past, this function does nothing and returns + * zero. Otherwise it returns one. * * \sa sched_request_barrier_or_min_delay(). */ -void sched_request_barrier(struct timeval *barrier, struct sched *s) +int sched_request_barrier(struct timeval *barrier, struct sched *s) { struct timeval diff; if (tv_diff(now, barrier, &diff) > 0) - return; + return 0; sched_request_timeout(&diff, s); + return 1; } /** @@ -321,15 +323,19 @@ void sched_request_barrier(struct timeval *barrier, struct sched *s) * \param barrier Absolute time before select() should return. * \param s Pointer to the scheduler struct. * - * If \a barrier is in the past, this function requests a minimal timeout. + * If \a barrier is in the past, this function requests a minimal timeout and + * returns zero. Otherwise it returns one. * * \sa sched_min_delay(), sched_request_barrier(). */ -void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s) +int sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s) { struct timeval diff; - if (tv_diff(now, barrier, &diff) > 0) - return sched_min_delay(s); + if (tv_diff(now, barrier, &diff) > 0) { + sched_min_delay(s); + return 0; + } sched_request_timeout(&diff, s); + return 1; }