|
|
@ -24,6 +24,9 @@ |
|
|
|
#include <string> |
|
|
|
#include <iostream> |
|
|
|
#include <thread> |
|
|
|
#ifdef __APPLE__ |
|
|
|
#include <pthread.h> |
|
|
|
#endif |
|
|
|
#include <boost/asio/ip/tcp.hpp> |
|
|
|
#include "Guards.h" |
|
|
|
using namespace std; |
|
|
@ -168,7 +171,7 @@ extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* l |
|
|
|
|
|
|
|
string dev::getThreadName() |
|
|
|
{ |
|
|
|
#ifdef __linux__ |
|
|
|
#if defined(__linux__) || defined(__APPLE__) |
|
|
|
char buffer[128]; |
|
|
|
pthread_getname_np(pthread_self(), buffer, 127); |
|
|
|
buffer[127] = 0; |
|
|
@ -180,8 +183,10 @@ string dev::getThreadName() |
|
|
|
|
|
|
|
void dev::setThreadName(string const& _n) |
|
|
|
{ |
|
|
|
#ifdef __linux__ |
|
|
|
#if defined(__linux__) |
|
|
|
pthread_setname_np(pthread_self(), _n.c_str()); |
|
|
|
#elsif defined(__APPLE__) |
|
|
|
pthread_setname_np(_n.c_str()); |
|
|
|
#else |
|
|
|
g_logThreadName.m_name.reset(new std::string(_n)); |
|
|
|
#endif |
|
|
|