From: Andre Noll Date: Sat, 30 Jan 2010 13:22:32 +0000 (+0100) Subject: sched: Add sched_request_barrier_or_min_delay(). X-Git-Tag: v0.4.2~66 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=f9f12278cf917fa0ebc69391de5913f9900a5f20 sched: Add sched_request_barrier_or_min_delay(). This is what some tasks need, so add this public function to the scheduler. --- diff --git a/sched.c b/sched.c index 5c185715..b6efb1ae 100644 --- a/sched.c +++ b/sched.c @@ -289,4 +289,11 @@ void sched_request_barrier(struct timeval *barrier, struct sched *s) sched_request_timeout(&diff, s); } +void 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); + sched_request_timeout(&diff, s); +} diff --git a/sched.h b/sched.h index 27c72391..452e749e 100644 --- a/sched.h +++ b/sched.h @@ -83,3 +83,4 @@ void sched_min_delay(struct sched *s); void sched_request_timeout(struct timeval *timeout, struct sched *s); void sched_request_timeout_ms(long unsigned ms, struct sched *s); void sched_request_barrier(struct timeval *barrier, struct sched *s); +void sched_request_barrier_or_min_delay(struct timeval *barrier, struct sched *s);