Fix the generic implementation of ExternalCommitHelper

This commit is contained in:
Thomas Goyne 2015-12-04 12:07:42 -08:00
parent 4eb49ce6dc
commit e557babaad
2 changed files with 6 additions and 3 deletions

View File

@ -32,7 +32,10 @@ ExternalCommitHelper::ExternalCommitHelper(RealmCoordinator& parent)
, m_sg(*m_history, parent.is_in_memory() ? SharedGroup::durability_MemOnly : SharedGroup::durability_Full,
parent.get_encryption_key().data())
, m_thread(std::async(std::launch::async, [=] {
m_sg.begin_read();
while (m_sg.wait_for_change()) {
m_sg.end_read();
m_sg.begin_read();
m_parent.on_change();
}
}))

View File

@ -40,12 +40,12 @@ public:
private:
RealmCoordinator& m_parent;
// The listener thread
std::future<void> m_thread;
// A shared group used to listen for changes
std::unique_ptr<ClientHistory> m_history;
SharedGroup m_sg;
// The listener thread
std::future<void> m_thread;
};
} // namespace _impl