summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2013-06-05 14:13:16 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2013-06-05 14:13:16 +0900
commit419094243a82b102599497f02bbe61d287682388 (patch)
treeb37da2fae2f9d6e63156c51101866edddf8789c3
parent216eaec1e62bf374747c07a2a1ee0e32d92f8d2d (diff)
wakeup
-rw-r--r--ChangeLog1
-rw-r--r--chopstx.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 73088d8..8afd432 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
diff --git a/chopstx.c b/chopstx.c
index 62d0d9a..8edca0d 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -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)