summaryrefslogtreecommitdiff
path: root/test/util/async_task.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/util/async_task.test.cpp')
-rw-r--r--test/util/async_task.test.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/util/async_task.test.cpp b/test/util/async_task.test.cpp
index f3025e8952..682926a17d 100644
--- a/test/util/async_task.test.cpp
+++ b/test/util/async_task.test.cpp
@@ -1,14 +1,15 @@
#include <mbgl/util/async_task.hpp>
-#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
-#include <mbgl/actor/actor_ref.hpp>
+#include <mbgl/actor/actor_ref.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <mbgl/test/util.hpp>
+#include <mbgl/util/run_loop.hpp>
#include <atomic>
#include <future>
#include <vector>
+using namespace mbgl;
using namespace mbgl::util;
namespace {
@@ -104,11 +105,11 @@ TEST(AsyncTask, RequestCoalescingMultithreaded) {
unsigned count = 0, numThreads = 25;
AsyncTask async([&count] { ++count; });
- mbgl::ThreadPool threads(numThreads);
- auto mailbox = std::make_shared<mbgl::Mailbox>(threads);
+ auto retainer = Scheduler::GetBackground();
+ auto mailbox = std::make_shared<Mailbox>(*retainer);
TestWorker worker(&async);
- mbgl::ActorRef<TestWorker> workerRef(worker, mailbox);
+ ActorRef<TestWorker> workerRef(worker, mailbox);
for (unsigned i = 0; i < numThreads; ++i) {
workerRef.invoke(&TestWorker::run);
@@ -133,11 +134,11 @@ TEST(AsyncTask, ThreadSafety) {
AsyncTask async([&count] { ++count; });
- mbgl::ThreadPool threads(numThreads);
- auto mailbox = std::make_shared<mbgl::Mailbox>(threads);
+ auto retainer = Scheduler::GetBackground();
+ auto mailbox = std::make_shared<Mailbox>(*retainer);
TestWorker worker(&async);
- mbgl::ActorRef<TestWorker> workerRef(worker, mailbox);
+ ActorRef<TestWorker> workerRef(worker, mailbox);
for (unsigned i = 0; i < numThreads; ++i) {
// The callback runs on the worker, thus the atomic type.