diff --git a/shared_realm.cpp b/shared_realm.cpp index fc5eaa2e..fa921fe7 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -23,11 +23,11 @@ #include #include +#include using namespace realm; RealmCache Realm::s_global_cache; -std::mutex Realm::s_init_mutex; Realm::Config::Config(const Config& c) : path(c.path), read_only(c.read_only), in_memory(c.in_memory), schema_version(c.schema_version), migration_function(c.migration_function) { @@ -108,6 +108,7 @@ SharedRealm Realm::get_shared_realm(Config &config) realm = SharedRealm(new Realm(config)); // we want to ensure we are only initializing a single realm at a time + static std::mutex s_init_mutex; std::lock_guard lock(s_init_mutex); uint64_t old_version = ObjectStore::get_schema_version(realm->read_group()); diff --git a/shared_realm.hpp b/shared_realm.hpp index 5344f1ef..31c0a79b 100644 --- a/shared_realm.hpp +++ b/shared_realm.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -117,8 +116,6 @@ namespace realm { Group *m_group; - static std::mutex s_init_mutex; - public: ExternalNotificationFunction m_external_notifier;