chopstx_wakeup_usec_wait

This commit is contained in:
NIIBE Yutaka
2013-06-05 13:41:53 +09:00
parent 2ccfe0732e
commit 216eaec1e6
3 changed files with 36 additions and 1 deletions

View File

@@ -1,3 +1,11 @@
2013-06-05 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (sched, preempt, svc, chx_timer_expired, chx_exit)
(chopstx_usec_wait, chopstx_mutex_lock, chopstx_cond_wait)
(chopstx_intr_wait, chopstx_join): Implement SCHED_RR.
(chopstx_create): Change API.
(chopstx_wakeup_usec_wait): New.
2013-06-04 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (AIRCR): New.

View File

@@ -1187,7 +1187,10 @@ chopstx_join (chopstx_t thd, void **ret)
chx_spin_unlock (&q_join.lock);
tp->flag_join_req = 1;
if (tp->prio < running->prio)
tp->prio = running->prio;
{
tp->prio = running->prio;
/*XXX: dequeue and enqueue with new prio. */
}
chx_sched (CHX_SLEEP);
}
else
@@ -1199,6 +1202,27 @@ chopstx_join (chopstx_t thd, void **ret)
}
void
chopstx_wakeup_usec_wait (chopstx_t thd)
{
struct chx_thread *tp = (struct chx_thread *)thd;
int yield = 0;
chx_cpu_sched_lock ();
if (tp->state == THREAD_WAIT_TIME)
{
chx_timer_dequeue (tp);
chx_ready_enqueue (tp);
if (tp->prio > running->prio)
yield = 1;
}
if (yield)
chx_sched (CHX_YIELD);
else
chx_cpu_sched_unlock ();
}
void
chopstx_cancel (chopstx_t thd)
{

View File

@@ -122,3 +122,6 @@ struct chx_cleanup {
/* NOTE: This signature is different to PTHREAD's one. */
void chopstx_cleanup_push (struct chx_cleanup *clp);
void chopstx_cleanup_pop (int execute);
void chopstx_wakeup_usec_wait (chopstx_t thd);