diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-05 13:41:53 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-05 13:41:53 +0900 |
commit | 216eaec1e62bf374747c07a2a1ee0e32d92f8d2d (patch) | |
tree | 7fb54f79ab1fbdc556c81637e8aa5fc5c57857eb | |
parent | 2ccfe0732e2e51ccaeea6ff4b07ab6e1f05c01dd (diff) |
chopstx_wakeup_usec_wait
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | chopstx.c | 26 | ||||
-rw-r--r-- | chopstx.h | 3 |
3 files changed, 36 insertions, 1 deletions
@@ -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. @@ -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 @@ -1200,6 +1203,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) { struct chx_thread *tp = (struct chx_thread *)thd; @@ -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); |