diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-29 13:55:20 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-29 13:55:20 +0200 |
commit | d6a38d545089b8e2d5be54e3f8e9ed497234c2ef (patch) | |
tree | 981537cd8a84dec1b342deb48ce004c4933db85f /libs/pbd | |
parent | f81442c3bfd315d15b566ccc7a1f295b3fd5c235 (diff) |
Set public thread name
This allows to identify Ardour thread using standard unix
tools (ps, htop) and inspect priorities, CPU load etc.
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/pthread_utils.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc index e369dbbfaf..f655dbd5b4 100644 --- a/libs/pbd/pthread_utils.cc +++ b/libs/pbd/pthread_utils.cc @@ -153,6 +153,14 @@ pthread_set_name (const char *str) /* copy string and delete it when exiting */ thread_name.set (strdup (str)); // leaks + +#if !defined PLATFORM_WINDOWS && defined _GNU_SOURCE + /* set public thread name, up to 16 chars */ + char ptn[16]; + memset (ptn, 0, 16); + strncpy (ptn, str, 15); + pthread_setname_np (pthread_self(), ptn); +#endif } const char * |