diff options
author | Dave Rigby <d.rigby@me.com> | 2022-02-28 19:05:36 +0300 |
---|---|---|
committer | Dave Rigby <daver@couchbase.com> | 2022-02-28 19:07:12 +0300 |
commit | 31e4bef13587877f5acb88c4ec10a8efdfb13ae8 (patch) | |
tree | 4bc733d9688961b96dbb55e0849c4f8cc76cf8af /common | |
parent | 6c33a23390d8062f250fb672c2edec17c3a02417 (diff) |
pthread_setname_np takes 1 arg on macOS
pthread_setname_np() can only set the name of the current thread on
macOS, so only pass a single name argument.
Fixes build break on macOS 12.2 with _GNU_SOURCE defined.
Diffstat (limited to 'common')
-rw-r--r-- | common/TracySystem.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/TracySystem.cpp b/common/TracySystem.cpp index b9754d33..1248fdee 100644 --- a/common/TracySystem.cpp +++ b/common/TracySystem.cpp @@ -155,14 +155,22 @@ TRACY_API void SetThreadName( const char* name ) const auto sz = strlen( name ); if( sz <= 15 ) { +#if defined __APPLE__ + pthread_setname_np( name ); +#else pthread_setname_np( pthread_self(), name ); +#endif } else { char buf[16]; memcpy( buf, name, 15 ); buf[15] = '\0'; +#if defined __APPLE__ + pthread_setname_np( buf ); +#else pthread_setname_np( pthread_self(), buf ); +#endif } } #endif |