Fix timer expiration.

This commit is contained in:
NIIBE Yutaka
2017-12-16 15:00:55 +09:00
parent 19b0590c1f
commit 530ddcfeda
3 changed files with 8 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2017-12-16 NIIBE Yutaka <gniibe@fsij.org>
* chopstx.c (chx_timer_expired): Bug fix of wake up.
(chx_mutex_unlock): Avoid non-deterministic thing.
2017-12-14 NIIBE Yutaka <gniibe@fsij.org>
* board/board-st-nucleo-f103.h: Update.

View File

@@ -287,7 +287,7 @@ chx_request_preemption (uint16_t prio)
*
* Returns:
* 1 on wakeup by others.
* 0 on normal wakeup.
* 0 on normal wakeup (timer expiration, getting lock).
* -1 on cancellation.
*/
static uintptr_t __attribute__ ((naked, noinline))

View File

@@ -403,6 +403,7 @@ chx_timer_expired (void)
tp = tp_next)
{
next_tick = tp->v;
tp->v = (uintptr_t)0;
tp_next = (struct chx_thread *)tp->next;
ll_dequeue ((struct chx_pq *)tp);
chx_ready_enqueue (tp);
@@ -575,6 +576,7 @@ chx_mutex_unlock (chopstx_mutex_t *mutex)
uint16_t newprio = running->prio_orig;
chopstx_mutex_t *m;
tp->v = (uintptr_t)0;
chx_ready_enqueue (tp);
/* Examine mutexes we hold, and determine new priority for running. */