diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-04-28 18:23:32 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-05-04 17:33:05 +0200 |
commit | 27d8e82e1ce7c6210a33f100cfb4f157ea9583d2 (patch) | |
tree | e97de81f16743ac7e527f796adc416cdc91e911c /platform | |
parent | 7390062c4589877dfc51e0b6f84e2fd5446b7a96 (diff) | |
download | qtlocation-mapboxgl-27d8e82e1ce7c6210a33f100cfb4f157ea9583d2.tar.gz |
lower thread priority of worker threads
Diffstat (limited to 'platform')
-rw-r--r-- | platform/darwin/nsthread.mm | 13 | ||||
-rw-r--r-- | platform/default/sqlite_cache.cpp | 2 | ||||
-rw-r--r-- | platform/default/thread.cpp | 11 |
3 files changed, 25 insertions, 1 deletions
diff --git a/platform/darwin/nsthread.mm b/platform/darwin/nsthread.mm new file mode 100644 index 0000000000..9ac1d2caa0 --- /dev/null +++ b/platform/darwin/nsthread.mm @@ -0,0 +1,13 @@ +#import <Foundation/Foundation.h> + +#include <mbgl/platform/platform.hpp> + +namespace mbgl { +namespace platform { + +void makeThreadLowPriority() { + [[NSThread currentThread] setThreadPriority:0.0]; +} + +} +} diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp index 83d42d5a5c..fb4cdf74e7 100644 --- a/platform/default/sqlite_cache.cpp +++ b/platform/default/sqlite_cache.cpp @@ -62,7 +62,7 @@ std::string unifyMapboxURLs(const std::string &url) { using namespace mapbox::sqlite; SQLiteCache::SQLiteCache(const std::string& path_) - : thread(util::make_unique<util::Thread<Impl>>("SQLite Cache", path_)) { + : thread(util::make_unique<util::Thread<Impl>>("SQLite Cache", util::ThreadPriority::Low, path_)) { } SQLiteCache::~SQLiteCache() = default; diff --git a/platform/default/thread.cpp b/platform/default/thread.cpp new file mode 100644 index 0000000000..c0a1069b9c --- /dev/null +++ b/platform/default/thread.cpp @@ -0,0 +1,11 @@ +#include <mbgl/platform/platform.hpp> + +namespace mbgl { +namespace platform { + +void makeThreadLowPriority() { + // no-op +} + +} +} |