blob: 9af9cf3cc4abf1e20b83aa02bf5b0150ae50a999 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#import <Foundation/Foundation.h>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/platform/thread.hpp>
#include <pthread.h>
namespace mbgl {
namespace platform {
std::string getCurrentThreadName() {
char name[32] = "unknown";
pthread_getname_np(pthread_self(), name, sizeof(name));
return name;
}
void setCurrentThreadName(const std::string& name) {
std::string qualifiedName = "com.mapbox.mbgl." + name;
pthread_setname_np(qualifiedName.c_str());
}
void makeThreadLowPriority() {
[[NSThread currentThread] setThreadPriority:0.0];
}
void setCurrentThreadPriority(double priority) {
if (priority > 1.0 || priority < 0.0) {
Log::Warning(Event::General, "Invalid thread priority was provided");
return;
}
[[NSThread currentThread] setThreadPriority:priority];
}
void attachThread() {
}
void detachThread() {
}
}
}
|