aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2015-09-14 18:36:56 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2015-09-15 10:26:40 +0900
commit8fed803085c9fd85bc177ee77e31fb20f52ce83e (patch)
tree20eef77bb56d0c1fbb6222dac71aa870e7cadc95
parent4705e2fb15ae58cc47a3df100949b07931d53526 (diff)
bug fixes around cancel/join/exit
-rw-r--r--ChangeLog6
-rw-r--r--chopstx.c14
2 files changed, 11 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 91d3cde..c86aea3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-14 Niibe Yutaka <gniibe@fsij.org>
+
+ * chopstx.c (q_exit): Remove.
+ (chx_init, chx_exit): Remove access to Q_EXIT.
+ (chx_release_irq_thread): Fix removing form the list.
+
2015-09-11 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (chx_init, chopstx_create): Fix the initial value
diff --git a/chopstx.c b/chopstx.c
index 07d9854..7868ae2 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -232,9 +232,6 @@ static struct chx_queue q_ready;
/* Queue of threads waiting for timer. */
static struct chx_queue q_timer;
-/* Queue of threads which have been exited. */
-static struct chx_queue q_exit;
-
/* Queue of threads which wait exit of some thread. */
static struct chx_queue q_join;
@@ -631,7 +628,6 @@ chx_init (struct chx_thread *tp)
memset (&tp->tc, 0, sizeof (tp->tc));
q_ready.next = q_ready.prev = (struct chx_thread *)&q_ready;
q_timer.next = q_timer.prev = (struct chx_thread *)&q_timer;
- q_exit.next = q_exit.prev = (struct chx_thread *)&q_exit;
q_join.next = q_join.prev = (struct chx_thread *)&q_join;
tp->next = tp->prev = tp;
tp->mutex_list = NULL;
@@ -724,13 +720,10 @@ chx_exit (void *retval)
if (running->flag_sched_rr)
chx_timer_dequeue (running);
- chx_spin_lock (&q_exit.lock);
- ll_insert (running, &q_exit);
if (running->flag_detached)
running->state = THREAD_FINISHED;
else
running->state = THREAD_EXITED;
- chx_spin_unlock (&q_exit.lock);
asm volatile ("" : : "r" (r8) : "memory");
chx_sched (CHX_SLEEP);
/* never comes here. */
@@ -1165,8 +1158,11 @@ chx_release_irq_thread (struct chx_thread *tp)
chx_spin_lock (&intr_lock);
intr_prev = intr_top;
for (intr = intr_top; intr; intr = intr->next)
- if (intr->tp == tp)
- break;
+ {
+ if (intr->tp == tp)
+ break;
+ intr_prev = intr;
+ }
if (intr)
{