diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-07-13 17:55:21 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-07-13 17:56:51 +0300 |
commit | 389c7615eb70483b19f5917395f8cd505c08361b (patch) | |
tree | aac1cda5d551d440f9aa6435c59fc7aa51b2012b /src/mbgl/util | |
parent | b9c273d19713f9712dc06c90364fc78224fac351 (diff) | |
download | qtlocation-mapboxgl-389c7615eb70483b19f5917395f8cd505c08361b.tar.gz |
[core] Revert workaround for std::atomic on ARMv5
Got fix on r12.
https://github.com/android-ndk/ndk/issues/31
Diffstat (limited to 'src/mbgl/util')
-rw-r--r-- | src/mbgl/util/atomic.hpp | 45 | ||||
-rw-r--r-- | src/mbgl/util/raster.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/util/thread.hpp | 1 |
3 files changed, 3 insertions, 48 deletions
diff --git a/src/mbgl/util/atomic.hpp b/src/mbgl/util/atomic.hpp deleted file mode 100644 index 3f68bf46a5..0000000000 --- a/src/mbgl/util/atomic.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include <atomic> -#include <mutex> - -namespace mbgl { -namespace util { - -// std::atomic<bool> is implemented lock free which -// is not supported by ARMv5 but the code generated -// seems to be using that and not working at all, -// thus, this naive implementation using mutexes. -#if defined(__ANDROID__) && defined(__ARM_ARCH_5TE__) - -template <typename T> -class Atomic { -public: - Atomic() = default; - explicit Atomic(const T& data_) : data(data_) {} - - void operator=(const T& other) { - std::lock_guard<std::mutex> lock(mtx); - data = other; - } - - operator bool() const { - std::lock_guard<std::mutex> lock(mtx); - - return data; - } - -private: - T data; - mutable std::mutex mtx; -}; - -#else - -template <typename T> -using Atomic = std::atomic<T>; - -#endif - -} // namespace util -} // namespace mbgl diff --git a/src/mbgl/util/raster.hpp b/src/mbgl/util/raster.hpp index a30c086323..34e7c67678 100644 --- a/src/mbgl/util/raster.hpp +++ b/src/mbgl/util/raster.hpp @@ -3,7 +3,8 @@ #include <mbgl/gl/object_store.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/optional.hpp> -#include <mbgl/util/atomic.hpp> + +#include <atomic> namespace mbgl { @@ -34,7 +35,7 @@ public: private: // raw pixels have been loaded - util::Atomic<bool> loaded { false }; + std::atomic<bool> loaded { false }; // filters Scaling filter = Scaling::Nearest; diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 0de897d726..643d272b25 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -6,7 +6,6 @@ #include <utility> #include <functional> -#include <mbgl/util/atomic.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/util/thread_context.hpp> #include <mbgl/platform/platform.hpp> |