BAN: Make WeakPtr::lock const

There is no reason why it would not be :)

Also this prevented upstream from compiling
This commit is contained in:
Bananymous 2025-06-11 16:53:43 +03:00
parent 69bdff6b7e
commit b97c123764
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ namespace BAN
class WeakLink : public RefCounted<WeakLink<T>> class WeakLink : public RefCounted<WeakLink<T>>
{ {
public: public:
RefPtr<T> try_lock() RefPtr<T> try_lock() const
{ {
#if __is_kernel #if __is_kernel
Kernel::SpinLockGuard _(m_weak_lock); Kernel::SpinLockGuard _(m_weak_lock);
@ -44,7 +44,7 @@ namespace BAN
private: private:
T* m_ptr; T* m_ptr;
#if __is_kernel #if __is_kernel
Kernel::SpinLock m_weak_lock; mutable Kernel::SpinLock m_weak_lock;
#endif #endif
friend class RefPtr<WeakLink<T>>; friend class RefPtr<WeakLink<T>>;
}; };
@ -99,7 +99,7 @@ namespace BAN
return *this; return *this;
} }
RefPtr<T> lock() RefPtr<T> lock() const
{ {
if (m_link) if (m_link)
return m_link->try_lock(); return m_link->try_lock();