1#pragma once
2
3#include <mbgl/actor/scheduler.hpp>
4
5#include <condition_variable>
6#include <mutex>
7#include <queue>
8#include <thread>
9
10namespace mbgl {
11
12class ThreadPool : public Scheduler {
13public:
14 ThreadPool(std::size_t count);
15 ~ThreadPool() override;
16
17 void schedule(std::weak_ptr<Mailbox>) override;
18
19private:
20 std::vector<std::thread> threads;
21 std::queue<std::weak_ptr<Mailbox>> queue;
22 std::mutex mutex;
23 std::condition_variable cv;
24 bool terminate { false };
25};
26
27} // namespace mbgl
28

source code of qtlocation/src/3rdparty/mapbox-gl-native/platform/default/mbgl/util/default_thread_pool.hpp