Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2016-09-01 17:23:57 +0300
committerYuri Gorshenin <y@maps.me>2016-09-01 18:27:59 +0300
commit30ef25bfb34beab674320723f1bcc598a784fffe (patch)
treedf87e64e58605358d779142f389eca51bde4af1a /editor
parenta43c309fc7adfbd853133debc712a86be3d149f9 (diff)
[indexer] Removed indexer dependency on search.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_config.hpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/editor/editor_config.hpp b/editor/editor_config.hpp
index f4217e1371..7e55b35549 100644
--- a/editor/editor_config.hpp
+++ b/editor/editor_config.hpp
@@ -2,6 +2,7 @@
#include "indexer/feature_meta.hpp"
+#include "std/mutex.hpp"
#include "std/shared_ptr.hpp"
#include "std/string.hpp"
#include "std/vector.hpp"
@@ -59,10 +60,24 @@ class EditorConfigWrapper
public:
EditorConfigWrapper() = default;
- void Set(shared_ptr<EditorConfig> config) { atomic_store(&m_config, config); }
- shared_ptr<EditorConfig const> Get() const { return atomic_load(&m_config); }
+ void Set(shared_ptr<EditorConfig> config)
+ {
+ lock_guard<mutex> lock(m_mu);
+ m_config = config;
+ }
+
+ shared_ptr<EditorConfig const> Get() const
+ {
+ lock_guard<mutex> lock(m_mu);
+ return m_config;
+ }
private:
+ // It's possible to use atomic_{load|store} here instead of mutex,
+ // but seems that libstdc++4.9 doesn't support it. Need to rewrite
+ // this code as soon as libstdc++5 will be ready for lastest Debian
+ // release, or as soon as atomic_shared_ptr will be ready.
+ mutable mutex m_mu;
shared_ptr<EditorConfig> m_config = make_shared<EditorConfig>();
// Just in case someone tryes to pass EditorConfigWrapper by value instead of referense.