mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-26 14:30:36 +00:00
Fix the generic implementation of ExternalCommitHelper
This commit is contained in:
parent
4eb49ce6dc
commit
e557babaad
@ -32,7 +32,10 @@ ExternalCommitHelper::ExternalCommitHelper(RealmCoordinator& parent)
|
|||||||
, m_sg(*m_history, parent.is_in_memory() ? SharedGroup::durability_MemOnly : SharedGroup::durability_Full,
|
, m_sg(*m_history, parent.is_in_memory() ? SharedGroup::durability_MemOnly : SharedGroup::durability_Full,
|
||||||
parent.get_encryption_key().data())
|
parent.get_encryption_key().data())
|
||||||
, m_thread(std::async(std::launch::async, [=] {
|
, m_thread(std::async(std::launch::async, [=] {
|
||||||
|
m_sg.begin_read();
|
||||||
while (m_sg.wait_for_change()) {
|
while (m_sg.wait_for_change()) {
|
||||||
|
m_sg.end_read();
|
||||||
|
m_sg.begin_read();
|
||||||
m_parent.on_change();
|
m_parent.on_change();
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
@ -40,12 +40,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
RealmCoordinator& m_parent;
|
RealmCoordinator& m_parent;
|
||||||
|
|
||||||
// The listener thread
|
|
||||||
std::future<void> m_thread;
|
|
||||||
|
|
||||||
// A shared group used to listen for changes
|
// A shared group used to listen for changes
|
||||||
std::unique_ptr<ClientHistory> m_history;
|
std::unique_ptr<ClientHistory> m_history;
|
||||||
SharedGroup m_sg;
|
SharedGroup m_sg;
|
||||||
|
|
||||||
|
// The listener thread
|
||||||
|
std::future<void> m_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace _impl
|
} // namespace _impl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user