summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-06 14:37:08 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-06 14:37:26 +0100
commit8088fa0556be1546e1893819d469a91901daa821 (patch)
tree76327422455bca67658bd6069f3da61233e44127
parenta803312eb4cbe95ce36b91cfd7c3eb793c189b5a (diff)
downloadserenity-8088fa0556be1546e1893819d469a91901daa821.zip
Kernel: Process::send_signal() should prefer main thread
The main/first thread in a process always has the same TID as the PID.
-rw-r--r--Kernel/Process.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 855e1fb160..431d0d21d8 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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)