]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
unify timed sleeps in the scheduler
authorAntti Kantee <pooka@iki.fi>
Mon, 20 Apr 2015 13:33:48 +0000 (13:33 +0000)
committerAntti Kantee <pooka@iki.fi>
Mon, 20 Apr 2015 13:33:48 +0000 (13:33 +0000)
include/bmk-core/sched.h
platform/baremetal/sched.c
platform/xen/xen/sched.c

index 076217bb51219978ae3f37c04b914c9b00305996..a900e1f7a05e197af0896b4865ce61fabc3603ee 100644 (file)
@@ -54,7 +54,6 @@ void  bmk_sched_block(struct bmk_thread *);
 void   bmk_sched_block_timeout(struct bmk_thread *, bmk_time_t);
 
 void   bmk_sched_wake(struct bmk_thread *);
-void   bmk_sched_setwakeup(struct bmk_thread *, bmk_time_t);
 
 int    bmk_sched_nanosleep(bmk_time_t);
 int    bmk_sched_nanosleep_abstime(bmk_time_t);
index f1e35fd68ce2bf8385aa240f5414d0219a32b1ea..ee5312174b55c8df77d65e6c0cf3fcd610b0f68e 100644 (file)
@@ -432,13 +432,6 @@ bmk_sched_nanosleep(bmk_time_t nsec)
        return bmk_sched_nanosleep_abstime(nsec + bmk_clock_monotonic());
 }
 
-void
-bmk_sched_setwakeup(struct bmk_thread *thread, bmk_time_t abstime)
-{
-
-       thread->bt_wakeup_time = abstime;
-}
-
 void
 bmk_sched_wake(struct bmk_thread *thread)
 {
index ea9583782e0d4266a3d4ba76e008c3a251699e45..ecd0346a2b87098708b33443512843c5e38331b9 100644 (file)
@@ -423,14 +423,14 @@ bmk_sched_block(struct bmk_thread *thread)
        bmk_sched_block_timeout(thread, -1);
 }
 
-static int
-dosleep(s_time_t wakeuptime)
+int
+bmk_sched_nanosleep_abstime(bmk_time_t nsec)
 {
        struct bmk_thread *thread = bmk_sched_current();
        int rv;
 
-       thread->bt_wakeup_time = wakeuptime;
        thread->bt_flags &= ~THREAD_TIMEDOUT;
+       thread->bt_wakeup_time = nsec;
        clear_runnable(thread);
        bmk_sched();
 
@@ -443,14 +443,7 @@ int
 bmk_sched_nanosleep(bmk_time_t nsec)
 {
 
-       return dosleep(NOW() + nsec);
-}
-
-int
-bmk_sched_nanosleep_abstime(bmk_time_t nsec)
-{
-
-       return dosleep(nsec);
+       return bmk_sched_nanosleep_abstime(nsec + bmk_clock_monotonic());
 }
 
 void