Kernel: Fix thread signal handling
Threads will now only handle signals once they are not holding any mutexes. This removes some dead locks.
This commit is contained in:
@@ -272,14 +272,7 @@ namespace Kernel
|
||||
memset(&m_interrupt_registers, 0, sizeof(InterruptRegisters));
|
||||
}
|
||||
|
||||
bool Thread::is_interrupted_by_signal()
|
||||
{
|
||||
while (can_add_signal_to_execute())
|
||||
handle_signal();
|
||||
return will_execute_signal();
|
||||
}
|
||||
|
||||
bool Thread::can_add_signal_to_execute() const
|
||||
bool Thread::is_interrupted_by_signal() const
|
||||
{
|
||||
if (!is_userspace() || m_state != State::Executing)
|
||||
return false;
|
||||
@@ -290,6 +283,11 @@ namespace Kernel
|
||||
return full_pending_mask & ~m_signal_block_mask;
|
||||
}
|
||||
|
||||
bool Thread::can_add_signal_to_execute() const
|
||||
{
|
||||
return is_interrupted_by_signal() && m_mutex_count == 0;
|
||||
}
|
||||
|
||||
bool Thread::will_execute_signal() const
|
||||
{
|
||||
if (!is_userspace() || m_state != State::Executing)
|
||||
|
||||
Reference in New Issue
Block a user