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

Kernel/TTY: Remove redundant SpinLock from VirtualConsole

VirtualConsole::m_lock was only used in a single place: on_tty_write()
That function is already protected by a global lock, so this second
lock served no purpose whatsoever.
This commit is contained in:
Andreas Kling 2021-08-07 12:36:21 +02:00
parent b5b67a1747
commit 58fb38551c
2 changed files with 1 additions and 3 deletions

View file

@ -260,7 +260,6 @@ void VirtualConsole::on_key_pressed(KeyEvent event)
KResultOr<size_t> VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, size_t size) KResultOr<size_t> VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, size_t size)
{ {
ScopedSpinLock global_lock(ConsoleManagement::the().tty_write_lock()); ScopedSpinLock global_lock(ConsoleManagement::the().tty_write_lock());
ScopedSpinLock lock(m_lock);
auto result = data.read_buffered<512>(size, [&](u8 const* buffer, size_t buffer_bytes) { auto result = data.read_buffered<512>(size, [&](u8 const* buffer, size_t buffer_bytes) {
for (size_t i = 0; i < buffer_bytes; ++i) for (size_t i = 0; i < buffer_bytes; ++i)
m_console_impl.on_input(buffer[i]); m_console_impl.on_input(buffer[i]);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il> * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
@ -118,7 +118,6 @@ private:
bool m_graphical { false }; bool m_graphical { false };
String m_tty_name; String m_tty_name;
RecursiveSpinLock m_lock;
private: private:
void initialize(); void initialize();