mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
AK: Decorate RefCountedBase::try_ref with nodiscard
Because try_ref only increments the ref count if it returned true, it is important that any caller properly acts upon the return value.
This commit is contained in:
parent
4adfdb98aa
commit
a6c459dd29
|
@ -74,7 +74,7 @@ public:
|
|||
ASSERT(!Checked<RefCountType>::addition_would_overflow(old_ref_count, 1));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool try_ref() const
|
||||
[[nodiscard]] ALWAYS_INLINE bool try_ref() const
|
||||
{
|
||||
RefCountType expected = m_ref_count.load(AK::MemoryOrder::memory_order_relaxed);
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue