diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-29 01:29:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-29 02:17:09 +0100 |
commit | b56646e2936c98a9b9ff89adbdd2e437ce218d92 (patch) | |
tree | 054666f9715fa1d05213e81c316ee18df8b398d5 /Kernel/Process.cpp | |
parent | 8ebec2938cd43d16655404ba86b20c73bfb724a7 (diff) | |
download | serenity-b56646e2936c98a9b9ff89adbdd2e437ce218d92.zip |
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.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 2bf8d13fd8..ccebd03bf9 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -139,7 +139,7 @@ ErrorOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>& auto name = TRY(KString::try_create(parts.last())); auto process = TRY(Process::try_create(first_thread, move(name), uid, gid, ProcessID(0), false, VirtualFileSystem::the().root_custody(), nullptr, tty)); - TRY(process->m_fds.with([&](auto& fds) -> ErrorOr<void> { + TRY(process->m_fds.with_exclusive([&](auto& fds) -> ErrorOr<void> { TRY(fds.try_resize(Process::OpenFileDescriptions::max_open())); auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : DeviceManagement::the().null_device(); @@ -589,7 +589,7 @@ void Process::finalize() if (m_alarm_timer) TimerQueue::the().cancel_timer(m_alarm_timer.release_nonnull()); - m_fds.with([](auto& fds) { fds.clear(); }); + m_fds.with_exclusive([](auto& fds) { fds.clear(); }); m_tty = nullptr; m_executable = nullptr; m_cwd = nullptr; |