diff options
Diffstat (limited to 'platform/default/src/mbgl/util/shared_thread_pool.cpp')
-rw-r--r-- | platform/default/src/mbgl/util/shared_thread_pool.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/util/shared_thread_pool.cpp b/platform/default/src/mbgl/util/shared_thread_pool.cpp new file mode 100644 index 0000000000..d7facbab94 --- /dev/null +++ b/platform/default/src/mbgl/util/shared_thread_pool.cpp @@ -0,0 +1,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 |