1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 19:37:34 +00:00

Kernel: Make SlavePTY store pointer to MasterPTY as NonnullRefPtr

No need for LockRefPtr here, as the pointer never changes after
initialization.
This commit is contained in:
Andreas Kling 2023-04-04 15:35:32 +02:00
parent e69b2572a6
commit 37bfc36601
2 changed files with 4 additions and 4 deletions

View file

@ -35,9 +35,9 @@ bool SlavePTY::unref() const
return did_hit_zero; return did_hit_zero;
} }
SlavePTY::SlavePTY(MasterPTY& master, unsigned index) SlavePTY::SlavePTY(NonnullRefPtr<MasterPTY> master, unsigned index)
: TTY(201, index) : TTY(201, index)
, m_master(master) , m_master(move(master))
, m_index(index) , m_index(index)
{ {
auto& process = Process::current(); auto& process = Process::current();

View file

@ -42,9 +42,9 @@ private:
virtual ErrorOr<void> close() override; virtual ErrorOr<void> close() override;
friend class MasterPTY; friend class MasterPTY;
SlavePTY(MasterPTY&, unsigned index); SlavePTY(NonnullRefPtr<MasterPTY>, unsigned index);
LockRefPtr<MasterPTY> m_master; NonnullRefPtr<MasterPTY> const m_master;
time_t m_time_of_last_write { 0 }; time_t m_time_of_last_write { 0 };
unsigned m_index { 0 }; unsigned m_index { 0 };