Fix setting thread name on macos
This commit is contained in:
parent
1036ebae30
commit
16dcbe9603
1 changed files with 5 additions and 1 deletions
|
|
@ -145,9 +145,13 @@ namespace psemek::log
|
||||||
void register_thread(std::string name)
|
void register_thread(std::string name)
|
||||||
{
|
{
|
||||||
#ifdef _PTHREAD_H
|
#ifdef _PTHREAD_H
|
||||||
#ifdef _GNU_SOURCE
|
#if (defined _GNU_SOURCE)
|
||||||
|
#if __APPLE__
|
||||||
|
::pthread_setname_np(name.data());
|
||||||
|
#else
|
||||||
::pthread_setname_np(::pthread_self(), name.data());
|
::pthread_setname_np(::pthread_self(), name.data());
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto id = std::this_thread::get_id();
|
auto id = std::this_thread::get_id();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue