diff --git a/ChangeLog b/ChangeLog index 296cd4f..575ea21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-12-08 NIIBE Yutaka + + * chopstx.c (chx_timer_dequeue): Fix calculation of return value. + 2018-12-07 NIIBE Yutaka * chopstx.c (chx_timer_dequeue): Return ticks remained. diff --git a/chopstx.c b/chopstx.c index 6b40456..498a00a 100644 --- a/chopstx.c +++ b/chopstx.c @@ -361,20 +361,18 @@ chx_timer_dequeue (struct chx_thread *tp) if (tp_prev == (struct chx_thread *)&q_timer.q) { if (tp->next == (struct chx_pq *)&q_timer.q) - chx_set_timer (tp_prev, 0); /* Cancel timer*/ + chx_systick_reload (0); /* Cancel timer. */ else - { /* Update timer. */ - ticks_remained += tp->v; - chx_set_timer (tp_prev, ticks_remained); - } + chx_systick_reload (ticks_remained + tp->v); /* Update timer. */ } else { struct chx_pq *p; - tp_prev->v += tp->v; for (p = q_timer.q.next; p != (struct chx_pq *)tp; p = p->next) ticks_remained += p->v; + + tp_prev->v += tp->v; } ll_dequeue ((struct chx_pq *)tp); tp->v = 0;