mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +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
Notes:
sideshowbarker
2024-07-19 00:07:19 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/a6c459dd290 Pull-request: https://github.com/SerenityOS/serenity/pull/4783
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue