mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
gthread: add thread name support on Solaris
https://bugzilla.gnome.org/show_bug.cgi?id=747478
This commit is contained in:
parent
3301b852a2
commit
28f0160031
10
configure.ac
10
configure.ac
@ -2095,6 +2095,16 @@ AS_IF([ test x"$have_threads" = xposix], [
|
||||
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
|
||||
[Have function pthread_setname_np(const char*)])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
dnl Sets thread names on Solaris 11.3 & higher
|
||||
AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <pthread.h>],
|
||||
[pthread_setname_np(pthread_self(), "example")])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
|
||||
[Have function pthread_setname_np(pthread_t, const char*)])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
CPPFLAGS="$glib_save_CPPFLAGS"
|
||||
])
|
||||
|
||||
|
@ -1231,6 +1231,8 @@ g_system_thread_set_name (const gchar *name)
|
||||
prctl (PR_SET_NAME, name, 0, 0, 0, 0); /* on Linux */
|
||||
#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
|
||||
pthread_setname_np(name); /* on OS X and iOS */
|
||||
#elif defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
|
||||
pthread_setname_np(pthread_self(), name); /* on Solaris */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user