author | Alan Coopersmith <Alan.Coopersmith@Oracle.COM> |
Thu, 28 Apr 2016 14:40:42 -0700 | |
changeset 5891 | 196a7310cc4d |
permissions | -rw-r--r-- |
5891
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
1 |
Submitted upstream in |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
2 |
https://bugzilla.gnome.org/show_bug.cgi?id=747478#c23 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
3 |
|
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
4 |
From 6b754f34d278038ff9daa3672399e5eb9b07da65 Mon Sep 17 00:00:00 2001 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
5 |
From: Alan Coopersmith <[email protected]> |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
6 |
Date: Sun, 6 Dec 2015 11:17:39 -0800 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
7 |
Subject: [PATCH] gthread: add thread name support on Solaris |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
8 |
|
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
9 |
--- |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
10 |
configure.ac | 10 ++++++++++ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
11 |
glib/gthread-posix.c | 2 ++ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
12 |
2 files changed, 12 insertions(+) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
13 |
|
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
14 |
diff --git a/configure.ac b/configure.ac |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
15 |
index 339defc..ccaead2 100644 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
16 |
--- a/configure.ac |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
17 |
+++ b/configure.ac |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
18 |
@@ -2174,6 +2174,16 @@ AS_IF([ test x"$have_threads" = xposix], [ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
19 |
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1, |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
20 |
[Have function pthread_setname_np(const char*)])], |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
21 |
[AC_MSG_RESULT(no)]) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
22 |
+ dnl Sets thread names on Solaris 11.3 & higher |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
23 |
+ AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*)) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
24 |
+ AC_LINK_IFELSE( |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
25 |
+ [AC_LANG_PROGRAM( |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
26 |
+ [#include <pthread.h>], |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
27 |
+ [pthread_setname_np(pthread_self(), "example")])], |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
28 |
+ [AC_MSG_RESULT(yes) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
29 |
+ AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1, |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
30 |
+ [Have function pthread_setname_np(pthread_t, const char*)])], |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
31 |
+ [AC_MSG_RESULT(no)]) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
32 |
CPPFLAGS="$glib_save_CPPFLAGS" |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
33 |
]) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
34 |
|
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
35 |
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
36 |
index bd3c9a1..184cdf9 100644 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
37 |
--- a/glib/gthread-posix.c |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
38 |
+++ b/glib/gthread-posix.c |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
39 |
@@ -1231,6 +1231,8 @@ g_system_thread_set_name (const gchar *name) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
40 |
prctl (PR_SET_NAME, name, 0, 0, 0, 0); /* on Linux */ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
41 |
#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
42 |
pthread_setname_np(name); /* on OS X and iOS */ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
43 |
+#elif defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
44 |
+ pthread_setname_np(pthread_self(), name); /* on Solaris */ |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
45 |
#endif |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
46 |
} |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
47 |
|
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
48 |
-- |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
49 |
2.6.1 |
196a7310cc4d
23169139 Move glib to Userland and update to 2.46.0
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
50 |