aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-05-23 17:45:10 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-05-23 17:45:10 +0900
commit77255b0c1d3272b38e75f76e02830556ec436cb9 (patch)
tree65b69da6b30a845773bc12ac7810ce063c89c91f
parenteeb354119c0304c935095bed5fc155aa67f7250b (diff)
Fix chopstx_poll
-rw-r--r--ChangeLog2
-rw-r--r--chopstx.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 295c2b2..55bc7e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2016-05-23 NIIBE Yutaka <gniibe@fsij.org>
+ * chopstx.c (chopstx_poll): Fix a race. Check COUNTER.
+
* example-cdc/usb-cdc.c (tty_input_char): Include newline.
* example-cdc/sample.c: Handle newline.
diff --git a/chopstx.c b/chopstx.c
index a407086..ac0d49b 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -1801,6 +1801,11 @@ chopstx_poll (uint32_t *usec_p, int n, ...)
{
chopstx_testcancel ();
chx_cpu_sched_lock ();
+ if (counter)
+ {
+ chx_cpu_sched_unlock ();
+ break;
+ }
r = chx_snooze (THREAD_WAIT_POLL, usec_p);
}
while (r == 0);