@@ -1,3 +1,8 @@
|
|||||||
|
2021-02-09 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* chopstx-gnu-linux.c (voluntary_context_switch): Fix for the case
|
||||||
|
when chx_idle suggests no context switch (tp_prev == tp_next).
|
||||||
|
|
||||||
2021-02-08 NIIBE Yutaka <gniibe@fsij.org>
|
2021-02-08 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* chopstx.c (chx_recv_irq): Bug fix when no waiter.
|
* chopstx.c (chx_recv_irq): Bug fix when no waiter.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* chopstx-gnu-linux.c - Threads and only threads: Arch specific code
|
* chopstx-gnu-linux.c - Threads and only threads: Arch specific code
|
||||||
* for GNU/Linux emulation
|
* for GNU/Linux emulation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017, 2018, 2019 Flying Stone Technology
|
* Copyright (C) 2017, 2018, 2019, 2021 Flying Stone Technology
|
||||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||||
*
|
*
|
||||||
* This file is a part of Chopstx, a thread library for embedded.
|
* This file is a part of Chopstx, a thread library for embedded.
|
||||||
@@ -260,14 +260,23 @@ preempted_context_switch (struct chx_thread *tp_next)
|
|||||||
static uintptr_t
|
static uintptr_t
|
||||||
voluntary_context_switch (struct chx_thread *tp_next)
|
voluntary_context_switch (struct chx_thread *tp_next)
|
||||||
{
|
{
|
||||||
struct chx_thread *tp, *tp_prev;
|
struct chx_thread *tp;
|
||||||
|
struct chx_thread *tp_prev;
|
||||||
if (!tp_next)
|
|
||||||
tp_next = chx_idle ();
|
|
||||||
|
|
||||||
tp_prev = chx_running ();
|
tp_prev = chx_running ();
|
||||||
chx_set_running (tp_next);
|
if (!tp_next)
|
||||||
swapcontext (&tp_prev->tc, &tp_next->tc);
|
{
|
||||||
|
chx_set_running (NULL);
|
||||||
|
tp_next = chx_idle ();
|
||||||
|
chx_set_running (tp_next);
|
||||||
|
if (tp_prev != tp_next)
|
||||||
|
swapcontext (&tp_prev->tc, &tp_next->tc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chx_set_running (tp_next);
|
||||||
|
swapcontext (&tp_prev->tc, &tp_next->tc);
|
||||||
|
}
|
||||||
chx_cpu_sched_unlock ();
|
chx_cpu_sched_unlock ();
|
||||||
|
|
||||||
tp = chx_running ();
|
tp = chx_running ();
|
||||||
|
|||||||
Reference in New Issue
Block a user