encoding+util: ensure move constructors are properly declared
This also fixes a race condition in scheduler::EventId::operator bool()
Change-Id: I468f0c46039a3d1a38c69c419ae45b4445d8205a
Refs: #3414
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index aecf15a..9e52b25 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -51,15 +51,16 @@
EventQueue::const_iterator queueIt;
};
-EventId::operator bool() const
+EventId::operator bool() const noexcept
{
- return !m_info.expired() && !m_info.lock()->isExpired;
+ auto sp = m_info.lock();
+ return sp != nullptr && !sp->isExpired;
}
bool
-EventId::operator==(const EventId& other) const
+EventId::operator==(const EventId& other) const noexcept
{
- return (!(*this) && !other) ||
+ return (!*this && !other) ||
!(m_info.owner_before(other.m_info) || other.m_info.owner_before(m_info));
}
@@ -70,7 +71,7 @@
}
bool
-EventQueueCompare::operator()(const shared_ptr<EventInfo>& a, const shared_ptr<EventInfo>& b) const
+EventQueueCompare::operator()(const shared_ptr<EventInfo>& a, const shared_ptr<EventInfo>& b) const noexcept
{
return a->expireTime < b->expireTime;
}