GNU/Linux: Application can exit by SIGINT or SIGTERM.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
* chopstx-gnu-linux.c (chopstx_create_arch): Fix ARGC of
|
||||
makecontext call.
|
||||
(chx_idle): Support exit by SIGINT or SIGTERM.
|
||||
|
||||
2021-02-09 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
|
||||
@@ -174,7 +174,13 @@ chx_idle (void)
|
||||
if (sig == SIGALRM)
|
||||
tp_next = chx_timer_expired ();
|
||||
else
|
||||
tp_next = chx_recv_irq (sig);
|
||||
{
|
||||
tp_next = chx_recv_irq (sig);
|
||||
/* Exit when there is no waiter and it's INT or TERM. */
|
||||
if (tp_next == NULL
|
||||
&& (sig == SIGINT || sig == SIGTERM))
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
return tp_next;
|
||||
@@ -280,7 +286,7 @@ voluntary_context_switch (struct chx_thread *tp_next)
|
||||
tp_next = chx_idle ();
|
||||
chx_set_running (tp_next);
|
||||
if (tp_prev != tp_next)
|
||||
swapcontext (&tp_prev->tc, &tp_next->tc);
|
||||
swapcontext (&tp_prev->tc, &tp_next->tc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user