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:
Ingo Weinhold 2009-03-19 13:57:10 +00:00
parent 7e6a04c78e
commit f68892b93e

View File

@ -505,16 +505,18 @@ deliver_signal(struct thread *thread, uint signal, uint32 flags)
switch (signal) {
case SIGKILL:
{
struct thread *mainThread = thread->team->main_thread;
// 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
if (mainThread->state == B_THREAD_SUSPENDED)
scheduler_enqueue_in_run_queue(mainThread);
else
thread_interrupt(mainThread, true);
update_thread_signals_flag(mainThread);
// Supposed to fall through
}
case SIGKILLTHR: