Kernel: Fix kernel panic on signal
Signals are now added/handled without Scheduler's lock
This commit is contained in:
parent
e447d5fccf
commit
9607b4205a
|
@ -247,7 +247,6 @@ namespace Kernel
|
||||||
|
|
||||||
void Process::exit(int status, int signal)
|
void Process::exit(int status, int signal)
|
||||||
{
|
{
|
||||||
LockGuard _(m_process_lock);
|
|
||||||
m_exit_status.exit_code = __WGENEXITCODE(status, signal);
|
m_exit_status.exit_code = __WGENEXITCODE(status, signal);
|
||||||
for (auto* thread : m_threads)
|
for (auto* thread : m_threads)
|
||||||
if (thread != &Thread::current())
|
if (thread != &Thread::current())
|
||||||
|
@ -330,6 +329,7 @@ namespace Kernel
|
||||||
BAN::ErrorOr<long> Process::sys_exit(int status)
|
BAN::ErrorOr<long> Process::sys_exit(int status)
|
||||||
{
|
{
|
||||||
ASSERT(this == &Process::current());
|
ASSERT(this == &Process::current());
|
||||||
|
LockGuard _(m_process_lock);
|
||||||
exit(status, 0);
|
exit(status, 0);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,9 +247,9 @@ namespace Kernel
|
||||||
m_lock.unlock(InterruptState::Disabled);
|
m_lock.unlock(InterruptState::Disabled);
|
||||||
start_thread(current->rsp(), current->rip());
|
start_thread(current->rsp(), current->rip());
|
||||||
case Thread::State::Executing:
|
case Thread::State::Executing:
|
||||||
|
m_lock.unlock(InterruptState::Disabled);
|
||||||
while (current->can_add_signal_to_execute())
|
while (current->can_add_signal_to_execute())
|
||||||
current->handle_signal();
|
current->handle_signal();
|
||||||
m_lock.unlock(InterruptState::Disabled);
|
|
||||||
continue_thread(current->rsp(), current->rip());
|
continue_thread(current->rsp(), current->rip());
|
||||||
case Thread::State::Terminated:
|
case Thread::State::Terminated:
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
Loading…
Reference in New Issue