Fix setting thread name on macos

This commit is contained in:
Nikita Lisitsa 2023-08-15 12:10:42 +03:00
parent 1036ebae30
commit 16dcbe9603

View file

@ -145,9 +145,13 @@ namespace psemek::log
void register_thread(std::string name)
{
#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());
#endif
#endif
#endif
auto id = std::this_thread::get_id();