1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

Kernel: Switch process file descriptor table from spinlock to mutex

There's no reason for this to use a spinlock. Instead, let's allow
threads to block if someone else is using the descriptor table.
This commit is contained in:
Andreas Kling 2022-01-29 01:29:07 +01:00
parent 8ebec2938c
commit b56646e293
16 changed files with 37 additions and 37 deletions

View file

@ -536,7 +536,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
clear_futex_queues_on_exec();
m_fds.with([&](auto& fds) {
m_fds.with_exclusive([&](auto& fds) {
fds.change_each([&](auto& file_description_metadata) {
if (file_description_metadata.is_valid() && file_description_metadata.flags() & FD_CLOEXEC)
file_description_metadata = {};
@ -545,7 +545,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
if (main_program_fd_allocation.has_value()) {
main_program_description->set_readable(true);
m_fds.with([&](auto& fds) { fds[main_program_fd_allocation->fd].set(move(main_program_description), FD_CLOEXEC); });
m_fds.with_exclusive([&](auto& fds) { fds[main_program_fd_allocation->fd].set(move(main_program_description), FD_CLOEXEC); });
}
new_main_thread = nullptr;