summaryrefslogtreecommitdiff
path: root/geom_matching/wasserstein/include/spdlog/details/null_mutex.h
diff options
context:
space:
mode:
authorArnur Nigmetov <a.nigmetov@gmail.com>2018-01-20 19:11:29 +0100
committerArnur Nigmetov <a.nigmetov@gmail.com>2018-01-20 19:11:29 +0100
commit0cc35ad04f9c2997014d7cf62a12f697e79fb534 (patch)
tree744c07bc2c12fba193934ac98417c5063bead189 /geom_matching/wasserstein/include/spdlog/details/null_mutex.h
parent3552ce68bc7654df35da471bd937b09a9fde101f (diff)
Major rewrite, templatized version
Diffstat (limited to 'geom_matching/wasserstein/include/spdlog/details/null_mutex.h')
-rw-r--r--geom_matching/wasserstein/include/spdlog/details/null_mutex.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/geom_matching/wasserstein/include/spdlog/details/null_mutex.h b/geom_matching/wasserstein/include/spdlog/details/null_mutex.h
new file mode 100644
index 0000000..67b0aee
--- /dev/null
+++ b/geom_matching/wasserstein/include/spdlog/details/null_mutex.h
@@ -0,0 +1,45 @@
+//
+// Copyright(c) 2015 Gabi Melman.
+// Distributed under the MIT License (http://opensource.org/licenses/MIT)
+//
+
+#pragma once
+
+#include <atomic>
+// null, no cost dummy "mutex" and dummy "atomic" int
+
+namespace spdlog
+{
+namespace details
+{
+struct null_mutex
+{
+ void lock() {}
+ void unlock() {}
+ bool try_lock()
+ {
+ return true;
+ }
+};
+
+struct null_atomic_int
+{
+ int value;
+ null_atomic_int() = default;
+
+ null_atomic_int(int val):value(val)
+ {}
+
+ int load(std::memory_order) const
+ {
+ return value;
+ }
+
+ void store(int val)
+ {
+ value = val;
+ }
+};
+
+}
+}