From f9f12278cf917fa0ebc69391de5913f9900a5f20 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 30 Jan 2010 14:22:32 +0100 Subject: [PATCH] sched: Add sched_request_barrier_or_min_delay(). This is what some tasks need, so add this public function to the scheduler. --- sched.c | 7 +++++++ sched.h | 1 + 2 files changed, 8 insertions(+) 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); -- 2.39.5