mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +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
1 changed files with 1 additions and 1 deletions
|
@ -74,7 +74,7 @@ public:
|
||||||
ASSERT(!Checked<RefCountType>::addition_would_overflow(old_ref_count, 1));
|
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);
|
RefCountType expected = m_ref_count.load(AK::MemoryOrder::memory_order_relaxed);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue