mirror of https://github.com/Icinga/icinga2.git
Build fix: Check if pthread_setname_np() is available.
This commit is contained in:
parent
df729d5514
commit
161c933edc
|
@ -52,6 +52,9 @@ AD_INIT_ASCIIDOC([icinga], [docs])
|
|||
|
||||
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
|
||||
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE -pthread"
|
||||
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE -pthread"
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
|
@ -71,7 +74,7 @@ AC_CHECK_LIB(m, floor)
|
|||
AC_CHECK_LIB(socket, getsockname)
|
||||
AC_CHECK_LIB(ws2_32, getsockname)
|
||||
AC_CHECK_LIB(shlwapi, PathRemoveFileSpecA)
|
||||
AC_CHECK_FUNCS([backtrace_symbols execvpe pipe2])
|
||||
AC_CHECK_FUNCS([backtrace_symbols execvpe pipe2 pthread_set_name_np pthread_setname_np])
|
||||
|
||||
CFLAGS="$CFLAGS -Wall -Wextra"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wextra"
|
||||
|
|
|
@ -525,14 +525,18 @@ void Utility::SetThreadName(const String& name, bool os)
|
|||
WindowsSetThreadName(name.CStr());
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef __APPLE__
|
||||
pthread_setname_np(name.CStr());
|
||||
#endif /* __APPLE__ */
|
||||
#ifdef HAVE_PTHREAD_SET_NAME_NP
|
||||
pthread_set_name_np(pthread_self(), name.CStr());
|
||||
#endif /* HAVE_PTHREAD_SET_NAME_NP */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
# ifdef __APPLE__
|
||||
pthread_setname_np(name.CStr());
|
||||
# else /* __APPLE__ */
|
||||
String tname = name.SubStr(0, 15);
|
||||
pthread_setname_np(pthread_self(), tname.CStr());
|
||||
#endif /* __linux__ */
|
||||
# endif /* __APPLE__ */
|
||||
#endif /* HAVE_PTHREAD_SETNAME_NP */
|
||||
}
|
||||
|
||||
String Utility::GetThreadName(void)
|
||||
|
|
Loading…
Reference in New Issue