diff --git a/ChangeLog b/ChangeLog index 295c2b2..55bc7e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-05-23 NIIBE Yutaka + * 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);