bug fixes around cancel/join/exit
This commit is contained in:
@@ -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
|
||||
|
||||
14
chopstx.c
14
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user