refactor: Use move semantics in CCheckQueue::Add

Co-authored-by: Martin Leitner-Ankerl <martin.ankerl@gmail.com>
This commit is contained in:
Hennadii Stepanov
2023-03-21 13:03:41 +00:00
parent 0682003214
commit 6c2d5972f3
3 changed files with 14 additions and 5 deletions

View File

@@ -140,6 +140,17 @@ struct FrozenCleanupCheck {
cv.wait(l, []{ return nFrozen.load(std::memory_order_relaxed) == 0;});
}
}
FrozenCleanupCheck(FrozenCleanupCheck&& other) noexcept
{
should_freeze = other.should_freeze;
other.should_freeze = false;
}
FrozenCleanupCheck& operator=(FrozenCleanupCheck&& other) noexcept
{
should_freeze = other.should_freeze;
other.should_freeze = false;
return *this;
}
void swap(FrozenCleanupCheck& x) noexcept
{
std::swap(should_freeze, x.should_freeze);