summaryrefslogtreecommitdiff
path: root/platform/node/src/node_thread_pool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/node/src/node_thread_pool.cpp')
-rw-r--r--platform/node/src/node_thread_pool.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/platform/node/src/node_thread_pool.cpp b/platform/node/src/node_thread_pool.cpp
deleted file mode 100644
index de403c605c..0000000000
--- a/platform/node/src/node_thread_pool.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "node_thread_pool.hpp"
-#include "util/async_queue.hpp"
-
-#include <mbgl/actor/mailbox.hpp>
-#include <mbgl/platform/background_scheduler.hpp>
-
-namespace node_mbgl {
-
-NodeThreadPool::NodeThreadPool()
- : queue(new util::AsyncQueue<std::weak_ptr<mbgl::Mailbox>>(uv_default_loop(), [](std::weak_ptr<mbgl::Mailbox> mailbox) {
- Worker* worker = new Worker(mailbox);
- Nan::AsyncQueueWorker(worker);
- })) {
- // Don't keep the event loop alive.
- queue->unref();
-}
-
-NodeThreadPool::~NodeThreadPool() {
- queue->stop();
-}
-
-void NodeThreadPool::schedule(std::weak_ptr<mbgl::Mailbox> mailbox) {
- queue->send(std::move(mailbox));
-}
-
-NodeThreadPool::Worker::Worker(std::weak_ptr<mbgl::Mailbox> mailbox_)
- : AsyncWorker(nullptr),
- mailbox(std::move(mailbox_)) {};
-
-void NodeThreadPool::Worker::Execute() {
- mbgl::Mailbox::maybeReceive(mailbox);
-}
-
-void NodeThreadPool::Worker::WorkComplete() {
- // no-op to avoid calling nullptr callback
-}
-
-} // namespace node_mbgl
-
-namespace mbgl {
-namespace platform {
-
-Scheduler& GetBackgroundScheduler() {
- static node_mbgl::NodeThreadPool pool;
- return pool;
-}
-
-} // namespace platform
-} // namespace mbgl