From fe5564f40e3f945d46867b4c6e2b467d61008d31 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 19 Apr 2016 13:59:15 -0700 Subject: [PATCH] Change all of the mentions of 'query' in NotificationToken to 'notifier' --- src/collection_notifications.cpp | 16 ++++++++-------- src/collection_notifications.hpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/collection_notifications.cpp b/src/collection_notifications.cpp index cca23764..7eae2cb8 100644 --- a/src/collection_notifications.cpp +++ b/src/collection_notifications.cpp @@ -23,21 +23,21 @@ using namespace realm; using namespace realm::_impl; -NotificationToken::NotificationToken(std::shared_ptr<_impl::BackgroundCollection> query, size_t token) -: m_query(std::move(query)), m_token(token) +NotificationToken::NotificationToken(std::shared_ptr<_impl::BackgroundCollection> notifier, size_t token) +: m_notifier(std::move(notifier)), m_token(token) { } NotificationToken::~NotificationToken() { - // m_query itself (and not just the pointed-to thing) needs to be accessed + // m_notifier itself (and not just the pointed-to thing) needs to be accessed // atomically to ensure that there are no data races when the token is // destroyed after being modified on a different thread. // This is needed despite the token not being thread-safe in general as // users find it very surpringing for obj-c objects to care about what // thread they are deallocated on. - if (auto query = m_query.exchange({})) { - query->remove_callback(m_token); + if (auto notifier = m_notifier.exchange({})) { + notifier->remove_callback(m_token); } } @@ -46,10 +46,10 @@ NotificationToken::NotificationToken(NotificationToken&& rgt) = default; NotificationToken& NotificationToken::operator=(realm::NotificationToken&& rgt) { if (this != &rgt) { - if (auto query = m_query.exchange({})) { - query->remove_callback(m_token); + if (auto notifier = m_notifier.exchange({})) { + notifier->remove_callback(m_token); } - m_query = std::move(rgt.m_query); + m_notifier = std::move(rgt.m_notifier); m_token = rgt.m_token; } return *this; diff --git a/src/collection_notifications.hpp b/src/collection_notifications.hpp index f6366f48..c2dc9d03 100644 --- a/src/collection_notifications.hpp +++ b/src/collection_notifications.hpp @@ -35,7 +35,7 @@ namespace _impl { // A token which keeps an asynchronous query alive struct NotificationToken { NotificationToken() = default; - NotificationToken(std::shared_ptr<_impl::BackgroundCollection> query, size_t token); + NotificationToken(std::shared_ptr<_impl::BackgroundCollection> notifier, size_t token); ~NotificationToken(); NotificationToken(NotificationToken&&); @@ -45,7 +45,7 @@ struct NotificationToken { NotificationToken& operator=(NotificationToken const&) = delete; private: - util::AtomicSharedPtr<_impl::BackgroundCollection> m_query; + util::AtomicSharedPtr<_impl::BackgroundCollection> m_notifier; size_t m_token; };