diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2014-11-26 16:44:20 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2014-11-26 17:04:28 -0800 |
commit | bcc0db3742a71cb63e79f5f43317abdd34f189c2 (patch) | |
tree | 5254efa8479620c6564d6a7487e1b40598f9d211 /include | |
parent | bbb77434630c2a316542f379f519088a19ef2994 (diff) | |
download | qtlocation-mapboxgl-bcc0db3742a71cb63e79f5f43317abdd34f189c2.tar.gz |
Use noncopyable
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/uv_detail.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index 7b9abc6c56..a68d493101 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -1,19 +1,19 @@ #ifndef MBGL_UTIL_UV_DETAIL #define MBGL_UTIL_UV_DETAIL -#include <mbgl/util/ptr.hpp> #include <mbgl/util/uv-worker.h> +#include <mbgl/util/noncopyable.hpp> #include <uv.h> #include <functional> #include <cassert> +#include <memory> #include <string> - namespace uv { -class thread { +class thread : public mbgl::util::noncopyable { public: inline operator uv_thread_t *() { return &t; } @@ -21,7 +21,7 @@ private: uv_thread_t t; }; -class loop { +class loop : public mbgl::util::noncopyable { public: inline loop() { #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 @@ -51,7 +51,7 @@ private: uv_loop_t *l = nullptr; }; -class mutex { +class mutex : public mbgl::util::noncopyable { public: inline mutex() { if (uv_mutex_init(&mtx) != 0) { @@ -66,7 +66,7 @@ private: uv_mutex_t mtx; }; -class lock { +class lock : public mbgl::util::noncopyable { public: lock(mutex &mtx_) : mtx(mtx_) { mtx.lock(); } ~lock() { mtx.unlock(); } @@ -75,7 +75,7 @@ private: mutex &mtx; }; -class rwlock { +class rwlock : public mbgl::util::noncopyable { public: inline rwlock() { if (uv_rwlock_init(&mtx) != 0) { @@ -92,7 +92,7 @@ private: uv_rwlock_t mtx; }; -class readlock { +class readlock : public mbgl::util::noncopyable { public: inline readlock(rwlock &mtx_) : mtx(mtx_) { mtx.rdlock(); } inline readlock(const std::unique_ptr<rwlock> &mtx_) : mtx(*mtx_) { mtx.rdlock(); } @@ -102,7 +102,7 @@ private: rwlock &mtx; }; -class writelock { +class writelock : public mbgl::util::noncopyable { public: inline writelock(rwlock &mtx_) : mtx(mtx_) { mtx.wrlock(); } inline writelock(const std::unique_ptr<rwlock> &mtx_) : mtx(*mtx_) { mtx.wrlock(); } @@ -112,7 +112,7 @@ private: rwlock &mtx; }; -class worker { +class worker : public mbgl::util::noncopyable { public: inline worker(uv_loop_t *loop, unsigned int count, const char *name = nullptr) : w(new uv_worker_t) { uv_worker_init(w, loop, count, name); @@ -131,7 +131,7 @@ private: }; template <typename T> -class work { +class work : public mbgl::util::noncopyable { public: typedef std::function<void (T&)> work_callback; typedef std::function<void (T&)> after_work_callback; |