summaryrefslogtreecommitdiff
path: root/platform/darwin/src/nsthread.mm
blob: 6caa1be43ecb25d76c00bff904858c9370ee260e (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
#import <Foundation/Foundation.h>

#include <mbgl/util/platform.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) {
    pthread_setname_np(name.c_str());
}

void makeThreadLowPriority() {
    [[NSThread currentThread] setThreadPriority:0.0];
}

}
}