aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2017-06-16 10:17:19 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2017-06-16 10:31:40 +0900
commitd941299149e86750c0758da62f7327bdf4faf07d (patch)
treed31a1a49265b21caafa5cc3ccab0a18da2d7ee42
parentb2b0eb7418691480cbc9a8da793be9a70f70a9b4 (diff)
Fix chx_wakeup.
-rw-r--r--ChangeLog2
-rw-r--r--chopstx.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 805c06f..8483c01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2017-06-16 NIIBE Yutaka <gniibe@fsij.org>
+ * chopstx.c (chx_wakeup): Fix for RUNNING==NULL.
+
* mcu/usb-mkl27z.c (std_get_status): Use staic var, not auto.
2017-05-18 NIIBE Yutaka <gniibe@fsij.org>
diff --git a/chopstx.c b/chopstx.c
index 986bb90..61d4390 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -1,7 +1,7 @@
/*
* chopstx.c - Threads and only threads.
*
- * Copyright (C) 2013, 2014, 2015, 2016
+ * Copyright (C) 2013, 2014, 2015, 2016, 2017
* Flying Stone Technology
* Author: NIIBE Yutaka <gniibe@fsij.org>
*
@@ -911,7 +911,7 @@ chx_wakeup (struct chx_pq *pq)
if (tp->parent == &q_timer.q)
chx_timer_dequeue (tp);
chx_ready_enqueue (tp);
- if (tp->prio > running->prio)
+ if (!running || tp->prio > running->prio)
yield = 1;
}
chx_spin_unlock (&px->lock);
@@ -921,7 +921,7 @@ chx_wakeup (struct chx_pq *pq)
tp = (struct chx_thread *)pq;
((struct chx_stack_regs *)tp->tc.reg[REG_SP])->reg[REG_R0] = 1;
chx_ready_enqueue (tp);
- if (tp->prio > running->prio)
+ if (!running || tp->prio > running->prio)
yield = 1;
}