From 348f4a7b3920add7f1042837f81e5eeb111b591f Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 24 Aug 2015 13:14:59 -0700 Subject: [PATCH] Reduce s_init_mutex's scope --- shared_realm.cpp | 3 ++- shared_realm.hpp | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) 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;