diff options
Diffstat (limited to 'src/mbgl/util/thread.cpp')
-rw-r--r-- | src/mbgl/util/thread.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mbgl/util/thread.cpp b/src/mbgl/util/thread.cpp new file mode 100644 index 0000000000..016d23a928 --- /dev/null +++ b/src/mbgl/util/thread.cpp @@ -0,0 +1,19 @@ +#include <functional> +#include <mbgl/platform/settings.hpp> +#include <mbgl/util/platform.hpp> + +namespace mbgl { +namespace util { +std::function<void()> makeThreadPrioritySetter(std::string threadType_) { + return [threadType = std::move(threadType_)] { + auto& settings = platform::Settings::getInstance(); + auto value = settings.get(threadType); + if (auto* priority = value.getDouble()) { + platform::setCurrentThreadPriority(*priority); + } else { + platform::makeThreadLowPriority(); + } + }; +} +} // namespace util +} // namespace mbgl |