From e23d8adf8c7942950b0cf28d35efa25ec9fdff13 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 15 Jul 2016 19:43:47 +0300 Subject: [core] Clean-up threading #ifdefs --- platform/darwin/src/nsthread.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'platform/darwin/src') diff --git a/platform/darwin/src/nsthread.mm b/platform/darwin/src/nsthread.mm index 9ac1d2caa0..eee6d6991b 100644 --- a/platform/darwin/src/nsthread.mm +++ b/platform/darwin/src/nsthread.mm @@ -2,9 +2,22 @@ #include +#include + 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]; } -- cgit v1.2.1