[core] Add hooks for setting experimental thread priorities for mbgl threads
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include <mbgl/util/thread_pool.hpp>
|
||||
|
||||
#include <mbgl/platform/settings.hpp>
|
||||
#include <mbgl/platform/thread.hpp>
|
||||
#include <mbgl/util/platform.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
#include <mbgl/platform/thread.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -17,7 +18,13 @@ void ThreadedSchedulerBase::terminate() {
|
||||
}
|
||||
|
||||
std::thread ThreadedSchedulerBase::makeSchedulerThread(size_t index) {
|
||||
return std::thread([this, index]() {
|
||||
return std::thread([this, index] {
|
||||
auto& settings = platform::Settings::getInstance();
|
||||
auto value = settings.get(platform::EXPERIMENTAL_THREAD_PRIORITY_WORKER);
|
||||
if (auto* priority = value.getDouble()) {
|
||||
platform::setCurrentThreadPriority(*priority);
|
||||
}
|
||||
|
||||
platform::setCurrentThreadName(std::string{"Worker "} + util::toString(index + 1));
|
||||
platform::attachThread();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user