From c944b91190048e370d2adc362f0860d9f58e58f2 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 13 Feb 2015 13:51:28 +0000 Subject: os,llvmpipe: Set rasterizer thread names on Linux. To help identify llvmpipe rasterizer threads -- especially when there can be so many. We can eventually generalize this to other OSes, but for that we must restrict the function to be called from the current thread. See also http://stackoverflow.com/a/7989973 Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/os/os_thread.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gallium/auxiliary/os/os_thread.h') diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h index ff46a89..e9da895 100644 --- a/src/gallium/auxiliary/os/os_thread.h +++ b/src/gallium/auxiliary/os/os_thread.h @@ -85,6 +85,17 @@ static INLINE int pipe_thread_destroy( pipe_thread thread ) return thrd_detach( thread ); } +static INLINE void pipe_thread_setname( const char *name ) +{ +#if defined(HAVE_PTHREAD) +# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) + pthread_setname_np(pthread_self(), name); +# endif +#endif + (void)name; +} + /* pipe_mutex */ -- cgit v1.1