diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2016-09-10 21:14:19 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-09-13 16:55:26 -0400 |
commit | c4799f186b31e579721f5874c897f3f46db6ad0a (patch) | |
tree | b5df363dea0c53b77836a18b0792e26cd96353cf /os | |
parent | 75c1d04650f63464263c159d2e95364482be724f (diff) |
os: Use pthread_setname_np to set thread names if available
Autoconf logic borrowed from glib
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/inputthread.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/os/inputthread.c b/os/inputthread.c index 6b379f5ea..6aa0a9ce6 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -310,6 +310,12 @@ InputThreadDoWork(void *arg) inputThreadInfo->running = TRUE; +#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) + pthread_setname_np (pthread_self(), "InputThread"); +#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) + pthread_setname_np ("InputThread"); +#endif + ospoll_add(inputThreadInfo->fds, hotplugPipeRead, ospoll_trigger_level, InputThreadPipeNotify, @@ -422,6 +428,12 @@ InputThreadPreInit(void) } hotplugPipeWrite = hotplugPipe[1]; +#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) + pthread_setname_np (pthread_self(), "MainThread"); +#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) + pthread_setname_np ("MainThread"); +#endif + } /** |