diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-05 14:13:16 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-05 14:13:16 +0900 |
commit | 419094243a82b102599497f02bbe61d287682388 (patch) | |
tree | b37da2fae2f9d6e63156c51101866edddf8789c3 | |
parent | 216eaec1e62bf374747c07a2a1ee0e32d92f8d2d (diff) |
wakeup
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | chopstx.c | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -5,6 +5,7 @@ (chopstx_intr_wait, chopstx_join): Implement SCHED_RR. (chopstx_create): Change API. (chopstx_wakeup_usec_wait): New. + (chopstx_usec_wait): Accept wakeup to break. 2013-06-04 Niibe Yutaka <gniibe@fsij.org> @@ -849,6 +849,7 @@ chopstx_usec_wait (uint32_t usec) while (usec) { uint32_t usec0 = (usec > 200*1000) ? 200*1000: usec; + register int r8 asm ("r8") = 0; chx_cpu_sched_lock (); if (running->flag_sched_rr) @@ -856,7 +857,10 @@ chopstx_usec_wait (uint32_t usec) chx_spin_lock (&q_timer.lock); chx_timer_insert (running, usec0); chx_spin_unlock (&q_timer.lock); + asm ("" : "=r" (r8) : "r" (r8)); chx_sched (CHX_SLEEP); + if (r8) /* awakened */ + break; usec -= usec0; } } @@ -1211,6 +1215,7 @@ chopstx_wakeup_usec_wait (chopstx_t thd) chx_cpu_sched_lock (); if (tp->state == THREAD_WAIT_TIME) { + tp->tc.reg[REG_EXIT] = 1; chx_timer_dequeue (tp); chx_ready_enqueue (tp); if (tp->prio > running->prio) |