summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2013-06-12 16:04:07 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2013-06-12 16:04:07 +0900
commitfc75a46a8de75a71d03d469e71734f0725d6add5 (patch)
tree0651ca517926760472fc3d522a80996cd4c241c8
parent4dde668afbd44ffae98e71778bc50e68cd2fe660 (diff)
fix main thread
-rw-r--r--ChangeLog4
-rw-r--r--chopstx.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dfa3e0a..176dc7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-12 Niibe Yutaka <gniibe@fsij.org>
+
+ * chopstx.c (chx_init): Inhibit preemption for main thread.
+
2013-06-11 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (chx_timer_expired): Use uint16_t here.
diff --git a/chopstx.c b/chopstx.c
index 4d9bf24..fd1ce83 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -724,10 +724,15 @@ chx_init (struct chx_thread *tp)
tp->flag_got_cancel = tp->flag_join_req = 0;
tp->flag_sched_rr = (CHX_FLAGS_MAIN & CHOPSTX_SCHED_RR)? 1 : 0;
tp->flag_detached = (CHX_FLAGS_MAIN & CHOPSTX_DETACHED)? 1 : 0;
- tp->prio_orig = tp->prio = CHX_PRIO_MAIN;
+ tp->prio_orig = CHX_PRIO_MAIN;
+ tp->prio = 0;
tp->v = 0;
-
running = tp;
+
+ if (CHX_PRIO_MAIN >= CHOPSTX_PRIO_INHIBIT_PREEMPTION)
+ chx_cpu_sched_lock ();
+
+ tp->prio = CHX_PRIO_MAIN;
}