]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
Give "sleep indefinitely" a name: BMK_SCHED_BLOCK_INFTIME.
authorAntti Kantee <pooka@iki.fi>
Tue, 21 Apr 2015 15:31:16 +0000 (15:31 +0000)
committerAntti Kantee <pooka@iki.fi>
Tue, 21 Apr 2015 15:31:16 +0000 (15:31 +0000)
include/bmk-core/sched.h
lib/libbmk_core/sched.c

index 76dbb31bdd44f4c18f226d5768acd79afc0424a1..b0b056716f92acdfd45bdb8e1ba697a67d518ca9 100644 (file)
@@ -51,6 +51,7 @@ void  bmk_sched_join(struct bmk_thread *);
 void   bmk_sched_exit(void) __attribute__((__noreturn__));
 
 void   bmk_sched_block(struct bmk_thread *);
+#define BMK_SCHED_BLOCK_INFTIME -1
 void   bmk_sched_block_timeout(struct bmk_thread *, bmk_time_t);
 
 void   bmk_sched_wake(struct bmk_thread *);
index b7f40597b0e56ac48aff28e54edfb33eb3a08304..95634c46dfa6e759453cc7673ca1e602b6094464 100644 (file)
@@ -207,7 +207,8 @@ bmk_sched(void)
                next = NULL;
                TAILQ_FOREACH_SAFE(thread, &threads, bt_entries, tmp) {
                        if (!is_runnable(thread)
-                           && thread->bt_wakeup_time >= 0) {
+                           && thread->bt_wakeup_time
+                             != BMK_SCHED_BLOCK_INFTIME) {
                                if (thread->bt_wakeup_time <= tm) {
                                        thread->bt_flags |= THREAD_TIMEDOUT;
                                        bmk_sched_wake(thread);
@@ -310,7 +311,7 @@ bmk_sched_create(const char *name, void *cookie, int joinable,
 
        thread->bt_cookie = cookie;
 
-       thread->bt_wakeup_time = -1;
+       thread->bt_wakeup_time = BMK_SCHED_BLOCK_INFTIME;
 
        allocothertls(thread);
 
@@ -411,7 +412,7 @@ void
 bmk_sched_block(struct bmk_thread *thread)
 {
 
-       bmk_sched_block_timeout(thread, -1);
+       bmk_sched_block_timeout(thread, BMK_SCHED_BLOCK_INFTIME);
 }
 
 int
@@ -442,7 +443,7 @@ void
 bmk_sched_wake(struct bmk_thread *thread)
 {
 
-       thread->bt_wakeup_time = -1;
+       thread->bt_wakeup_time = BMK_SCHED_BLOCK_INFTIME;
        set_runnable(thread);
 }