aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2013-08-16 11:02:10 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2013-08-16 11:02:10 +0900
commit86ec749d755ad54254778596805bf5a71cdc2bbb (patch)
treeee2dfbadd835f3b989425020855374041508457a
parent8447b2ba8e7caf10f0c986f629bf457d3db7c5e7 (diff)
bug fix of chopstx_usec_wait_var
-rw-r--r--ChangeLog5
-rw-r--r--chopstx.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c061d4..ea9f8bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-16 Niibe Yutaka <gniibe@fsij.org>
+
+ * chopstx.c (chopstx_usec_wait_var): Check usec_p at the beginning
+ of the loop, bug fix of sched-unlocking from sched-unlocked state.
+
2013-06-19 Niibe Yutaka <gniibe@fsij.org>
* chopstx.h (CHOPSTX_THREAD_SIZE): New.
diff --git a/chopstx.c b/chopstx.c
index fdb0cf7..8038a55 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -919,6 +919,8 @@ chopstx_usec_wait_var (uint32_t *var)
while (1)
{
chx_cpu_sched_lock ();
+ if (!usec_p) /* awakened */
+ break;
*usec_p -= usec0;
usec = *usec_p;
if (usec == 0)
@@ -930,11 +932,8 @@ chopstx_usec_wait_var (uint32_t *var)
running->state = THREAD_WAIT_TIME;
chx_timer_insert (running, usec0);
chx_spin_unlock (&q_timer.lock);
- asm ("" : "=r" (usec_p) : "r" (usec_p));
chx_sched (CHX_SLEEP);
-
- if (!usec_p) /* awakened */
- break;
+ asm ("" : "=r" (usec_p) : "r" (usec_p));
}
chx_cpu_sched_unlock ();