Kernel: Process::send_signal() should prefer main thread

The main/first thread in a process always has the same TID as the PID.
This commit is contained in:
Andreas Kling 2020-01-06 14:37:08 +01:00
parent a803312eb4
commit 8088fa0556

View file

@ -3222,8 +3222,11 @@ void Process::terminate_due_to_signal(u8 signal)
void Process::send_signal(u8 signal, Process* sender)
{
// FIXME(Thread): Find the appropriate thread to deliver the signal to.
any_thread().send_signal(signal, sender);
InterruptDisabler disabler;
auto* thread = Thread::from_tid(m_pid);
if (!thread)
thread = &any_thread();
thread->send_signal(signal, sender);
}
int Process::sys$create_thread(void* (*entry)(void*), void* argument, const Syscall::SC_create_thread_params* params)