diff options
author | Dane Springmeyer <dane@mapbox.com> | 2019-09-08 15:08:48 -0700 |
---|---|---|
committer | Dane Springmeyer <dane@mapbox.com> | 2019-09-08 15:08:48 -0700 |
commit | 88be996edabaaa45c786fe28d2b1e755e2f7907b (patch) | |
tree | e76bd780f2e1a4dad79580f842648fa6487047c8 | |
parent | 5526b518dfc9e6589d9386f142b171465517ce4c (diff) | |
download | qtlocation-mapboxgl-upstream/sync-rendering.tar.gz |
revert threadpool changeupstream/sync-rendering
-rw-r--r-- | src/mbgl/actor/scheduler.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/mbgl/actor/scheduler.cpp b/src/mbgl/actor/scheduler.cpp index fa5127387c..fd48454880 100644 --- a/src/mbgl/actor/scheduler.cpp +++ b/src/mbgl/actor/scheduler.cpp @@ -22,21 +22,17 @@ Scheduler* Scheduler::GetCurrent() { // static std::shared_ptr<Scheduler> Scheduler::GetBackground() { - // static std::weak_ptr<Scheduler> weak; - // static std::mutex mtx; - // - // std::lock_guard<std::mutex> lock(mtx); - // std::shared_ptr<Scheduler> scheduler = weak.lock(); - // - // if (!scheduler) { - // std::clog << "creating scheduler\n"; - // weak = scheduler = std::make_shared<ThreadPool>(4); - // } else { - // std::clog << "re-using scheduler\n"; - // } - // - // return scheduler; - return std::make_shared<ThreadPool>(2); + static std::weak_ptr<Scheduler> weak; + static std::mutex mtx; + + std::lock_guard<std::mutex> lock(mtx); + std::shared_ptr<Scheduler> scheduler = weak.lock(); + + if (!scheduler) { + //std::clog << "creating scheduler\n"; + weak = scheduler = std::make_shared<ThreadPool>(4); + } + return scheduler; } } //namespace mbgl |