mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:15:10 +00:00
Kernel/Tasks: Allow Kernel processes to be shut down
Since we never check a kernel process's state like a userland process, it's possible for a kernel process to ignore the fact that someone is trying to kill it, and continue running. This is not desireable if we want to properly shutdown all processes, including Kernel ones.
This commit is contained in:
parent
8940552d1d
commit
021fb3ea05
7 changed files with 22 additions and 9 deletions
|
@ -327,7 +327,7 @@ size_t Plan9FS::adjust_buffer_size(size_t size) const
|
|||
void Plan9FS::thread_main()
|
||||
{
|
||||
dbgln("Plan9FS: Thread running");
|
||||
do {
|
||||
while (!Process::current().is_dying()) {
|
||||
auto result = read_and_dispatch_one_message();
|
||||
if (result.is_error()) {
|
||||
// If we fail to read, wake up everyone with an error.
|
||||
|
@ -342,7 +342,7 @@ void Plan9FS::thread_main()
|
|||
dbgln("Plan9FS: Thread terminating, error reading");
|
||||
return;
|
||||
}
|
||||
} while (!m_thread_shutdown);
|
||||
}
|
||||
dbgln("Plan9FS: Thread terminating");
|
||||
}
|
||||
|
||||
|
@ -356,6 +356,8 @@ void Plan9FS::ensure_thread()
|
|||
auto [_, thread] = Process::create_kernel_process(process_name.release_value(), [&]() {
|
||||
thread_main();
|
||||
m_thread_running.store(false, AK::MemoryOrder::memory_order_release);
|
||||
Process::current().sys$exit(0);
|
||||
VERIFY_NOT_REACHED();
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
m_thread = move(thread);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue