deliver_signal() SIGKILL:
* Use atomic_or() to update sig_pending of the main thread. * We didn't call update_thread_signals_flag() for the main thread, so its handle_signals() wouldn't be called, resulting in an infinite loop, if this signal interrupted a restartable syscall. Calling exit() from another thread than the main thread was likely to run into this problem. Should fix #3178. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29612 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -505,16 +505,18 @@ deliver_signal(struct thread *thread, uint signal, uint32 flags)
|
|||||||
switch (signal) {
|
switch (signal) {
|
||||||
case SIGKILL:
|
case SIGKILL:
|
||||||
{
|
{
|
||||||
struct thread *mainThread = thread->team->main_thread;
|
|
||||||
// Forward KILLTHR to the main thread of the team
|
// Forward KILLTHR to the main thread of the team
|
||||||
|
struct thread *mainThread = thread->team->main_thread;
|
||||||
|
atomic_or(&mainThread->sig_pending, SIGNAL_TO_MASK(SIGKILLTHR));
|
||||||
|
|
||||||
mainThread->sig_pending |= SIGNAL_TO_MASK(SIGKILLTHR);
|
|
||||||
// Wake up main thread
|
// Wake up main thread
|
||||||
if (mainThread->state == B_THREAD_SUSPENDED)
|
if (mainThread->state == B_THREAD_SUSPENDED)
|
||||||
scheduler_enqueue_in_run_queue(mainThread);
|
scheduler_enqueue_in_run_queue(mainThread);
|
||||||
else
|
else
|
||||||
thread_interrupt(mainThread, true);
|
thread_interrupt(mainThread, true);
|
||||||
|
|
||||||
|
update_thread_signals_flag(mainThread);
|
||||||
|
|
||||||
// Supposed to fall through
|
// Supposed to fall through
|
||||||
}
|
}
|
||||||
case SIGKILLTHR:
|
case SIGKILLTHR:
|
||||||
|
|||||||
Reference in New Issue
Block a user