mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
Kernel: Protect PTYMultiplexer freelist with spinlock instead of mutex
This commit is contained in:
parent
6fbb924bbf
commit
0899153170
2 changed files with 4 additions and 5 deletions
|
@ -24,7 +24,7 @@ PTYMultiplexer& PTYMultiplexer::the()
|
|||
UNMAP_AFTER_INIT PTYMultiplexer::PTYMultiplexer()
|
||||
: CharacterDevice(5, 2)
|
||||
{
|
||||
m_freelist.with_exclusive([&](auto& freelist) {
|
||||
m_freelist.with([&](auto& freelist) {
|
||||
freelist.ensure_capacity(max_pty_pairs);
|
||||
for (int i = max_pty_pairs; i > 0; --i)
|
||||
freelist.unchecked_append(i - 1);
|
||||
|
@ -42,7 +42,7 @@ UNMAP_AFTER_INIT void PTYMultiplexer::initialize()
|
|||
|
||||
ErrorOr<NonnullRefPtr<OpenFileDescription>> PTYMultiplexer::open(int options)
|
||||
{
|
||||
return m_freelist.with_exclusive([&](auto& freelist) -> ErrorOr<NonnullRefPtr<OpenFileDescription>> {
|
||||
return m_freelist.with([&](auto& freelist) -> ErrorOr<NonnullRefPtr<OpenFileDescription>> {
|
||||
if (freelist.is_empty())
|
||||
return EBUSY;
|
||||
|
||||
|
@ -58,7 +58,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> PTYMultiplexer::open(int options)
|
|||
|
||||
void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
|
||||
{
|
||||
m_freelist.with_exclusive([&](auto& freelist) {
|
||||
m_freelist.with([&](auto& freelist) {
|
||||
freelist.append(index);
|
||||
dbgln_if(PTMX_DEBUG, "PTYMultiplexer: {} added to freelist", index);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue