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

namespace mbgl {

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

} // namespace mbgl