diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index b5896c2796..fc24d2d731 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -95,6 +95,12 @@ void Process::sys$exit_thread(Userspace exit_value) { REQUIRE_PROMISE(thread); cli(); + + if (this->thread_count() == 1) { + // If this is the last thread, instead kill the process. + this->sys$exit(0); + } + Thread::current()->exit(reinterpret_cast(exit_value.ptr())); ASSERT_NOT_REACHED(); }