Add tests for pthread_set_name_np() and pthread_setname_np()

Looks like the conversion from autoconf to CMake dropped
these tests along the way.
This commit is contained in:
Brad Smith 2025-11-25 11:31:32 -05:00 committed by Alvar Penning
parent 883601ea95
commit cf8fc3d64f
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View File

@ -371,6 +371,8 @@ check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
check_function_exists(pipe2 HAVE_PIPE2)
check_function_exists(nice HAVE_NICE)
check_function_exists(malloc_info HAVE_MALLOC_INFO)
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR)
check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO)
check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)

View File

@ -9,6 +9,8 @@
#cmakedefine HAVE_CXXABI_H
#cmakedefine HAVE_NICE
#cmakedefine HAVE_MALLOC_INFO
#cmakedefine HAVE_PTHREAD_SET_NAME_NP
#cmakedefine HAVE_PTHREAD_SETNAME_NP
#cmakedefine HAVE_EDITLINE
#cmakedefine HAVE_SYSTEMD

View File

@ -1320,9 +1320,7 @@ void Utility::SetThreadName(const String& name, bool os)
#ifdef HAVE_PTHREAD_SET_NAME_NP
pthread_set_name_np(pthread_self(), name.CStr());
#endif /* HAVE_PTHREAD_SET_NAME_NP */
#ifdef HAVE_PTHREAD_SETNAME_NP
#elif defined(HAVE_PTHREAD_SETNAME_NP) /* HAVE_PTHREAD_SET_NAME_NP */
# ifdef __APPLE__
pthread_setname_np(name.CStr());
# else /* __APPLE__ */