summaryrefslogtreecommitdiff
path: root/platform/default/src/mbgl/util/shared_thread_pool.cpp
blob: d7facbab94c356e652f0efdd33a1183e55996c43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <mbgl/util/shared_thread_pool.hpp>

namespace mbgl {

std::shared_ptr<ThreadPool> sharedThreadPool() {
    static std::weak_ptr<ThreadPool> weak;
    auto pool = weak.lock();
    if (!pool) {
        weak = pool = std::make_shared<ThreadPool>(4);
    }
    return pool;
}

} // namespace mbgl