This commit is contained in:
NIIBE Yutaka
2013-06-05 14:13:16 +09:00
parent 216eaec1e6
commit 419094243a
2 changed files with 6 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
(chopstx_intr_wait, chopstx_join): Implement SCHED_RR. (chopstx_intr_wait, chopstx_join): Implement SCHED_RR.
(chopstx_create): Change API. (chopstx_create): Change API.
(chopstx_wakeup_usec_wait): New. (chopstx_wakeup_usec_wait): New.
(chopstx_usec_wait): Accept wakeup to break.
2013-06-04 Niibe Yutaka <gniibe@fsij.org> 2013-06-04 Niibe Yutaka <gniibe@fsij.org>

View File

@@ -849,6 +849,7 @@ chopstx_usec_wait (uint32_t usec)
while (usec) while (usec)
{ {
uint32_t usec0 = (usec > 200*1000) ? 200*1000: usec; uint32_t usec0 = (usec > 200*1000) ? 200*1000: usec;
register int r8 asm ("r8") = 0;
chx_cpu_sched_lock (); chx_cpu_sched_lock ();
if (running->flag_sched_rr) if (running->flag_sched_rr)
@@ -856,7 +857,10 @@ chopstx_usec_wait (uint32_t usec)
chx_spin_lock (&q_timer.lock); chx_spin_lock (&q_timer.lock);
chx_timer_insert (running, usec0); chx_timer_insert (running, usec0);
chx_spin_unlock (&q_timer.lock); chx_spin_unlock (&q_timer.lock);
asm ("" : "=r" (r8) : "r" (r8));
chx_sched (CHX_SLEEP); chx_sched (CHX_SLEEP);
if (r8) /* awakened */
break;
usec -= usec0; usec -= usec0;
} }
} }
@@ -1211,6 +1215,7 @@ chopstx_wakeup_usec_wait (chopstx_t thd)
chx_cpu_sched_lock (); chx_cpu_sched_lock ();
if (tp->state == THREAD_WAIT_TIME) if (tp->state == THREAD_WAIT_TIME)
{ {
tp->tc.reg[REG_EXIT] = 1;
chx_timer_dequeue (tp); chx_timer_dequeue (tp);
chx_ready_enqueue (tp); chx_ready_enqueue (tp);
if (tp->prio > running->prio) if (tp->prio > running->prio)