From 0c087603e602bbb5ad25b4924f49169a316f695e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 9 Apr 2015 11:51:57 -0700 Subject: Replace uv_messenger with AsyncQueue; rewrite remaining uv_* in C++ --- src/mbgl/util/uv_detail.hpp | 51 --------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'src/mbgl/util/uv_detail.hpp') diff --git a/src/mbgl/util/uv_detail.hpp b/src/mbgl/util/uv_detail.hpp index 6ae3713e09..9d479da425 100644 --- a/src/mbgl/util/uv_detail.hpp +++ b/src/mbgl/util/uv_detail.hpp @@ -2,7 +2,6 @@ #define MBGL_UTIL_UV_DETAIL #include -#include #include #include @@ -117,56 +116,6 @@ private: uv_rwlock_t mtx; }; -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); - } - inline ~worker() { - uv_worker_close(w, [](uv_worker_t *worker_) { - delete worker_; - }); - } - inline void add(void *data, uv_worker_cb work_cb, uv_worker_after_cb after_work_cb) { - uv_worker_send(w, data, work_cb, after_work_cb); - } - -private: - uv_worker_t *w; -}; - -template -class work : public mbgl::util::noncopyable { -public: - typedef std::function work_callback; - typedef std::function after_work_callback; - - template - work(worker &worker, work_callback work_cb_, after_work_callback after_work_cb_, Args&&... args) - : data(std::forward(args)...), - work_cb(work_cb_), - after_work_cb(after_work_cb_) { - worker.add(this, do_work, after_work); - } - -private: - static void do_work(void *data) { - work *w = reinterpret_cast *>(data); - w->work_cb(w->data); - } - - static void after_work(void *data) { - work *w = reinterpret_cast *>(data); - w->after_work_cb(w->data); - delete w; - } - -private: - T data; - work_callback work_cb; - after_work_callback after_work_cb; -}; - } #endif -- cgit v1.2.1