X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=sched.c;h=385dde61f0fc210dd52bdb1192b392e39061977b;hp=ca365f17e911d13a49688196ecfd1bcfab5d0363;hb=5ff2b0b3a6f9242033c436fb8272245f5594dd8c;hpb=d49cd9a91015766cb19d7d43bb04048265925fe5 diff --git a/sched.c b/sched.c index ca365f17..385dde61 100644 --- a/sched.c +++ b/sched.c @@ -311,17 +311,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; } /** @@ -330,15 +332,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; }