summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-07 16:21:02 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-07 16:21:02 +0000
commit65b76d92a4792b5960967b63f4c85dc6859bb807 (patch)
tree9f572223d01a3777f96e5c584755d2776caece27
parentb494603551d1a6c8fbc56ba90a35451e84af4d2e (diff)
merge revision(s) r45190,r45202,r45204,r45713: [Backport #9586]
configure.in: define SET_THREAD_NAME * configure.in (SET_THREAD_NAME): define according to pthread_setname_np variations. * configure.in: correct pthread_setname_np's prototype on NetBSD. [Bug #9586] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--configure.in30
-rw-r--r--thread_pthread.c6
-rw-r--r--version.h2
4 files changed, 38 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 603eac5..1d4751a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu May 8 01:13:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: correct pthread_setname_np's prototype on NetBSD.
+ [Bug #9586]
+
Tue May 6 00:54:56 2014 Narihiro Nakamura <authornari@gmail.com>
* gc.c (gc_after_sweep): suppress unnecessary expanding heap.
diff --git a/configure.in b/configure.in
index 17ed3ed..1a001e6 100644
--- a/configure.in
+++ b/configure.in
@@ -2454,6 +2454,36 @@ if test x"$enable_pthread" = xyes; then
else
AC_CHECK_FUNCS(pthread_attr_init)
fi
+ if test "$ac_cv_func_pthread_setname_np" = yes; then
+ AC_CACHE_CHECK([arguments of pthread_setname_np], [rb_cv_func_pthread_setname_np_arguments],
+ [rb_cv_func_pthread_setname_np_arguments=
+ # Linux,AIX, (pthread_self(), name)
+ # NetBSD (pthread_self(), name, \"%s\")
+ # Darwin (name)
+ for mac in \
+ "(pthread_self(), name)" \
+ "(pthread_self(), name, \"%s\")" \
+ "(name)" \
+ ; do
+ AC_TRY_COMPILE([
+ @%:@include <pthread.h>
+ @%:@ifdef HAVE_PTHREAD_NP_H
+ @%:@include <pthread_np.h>
+ @%:@endif
+ @%:@define SET_THREAD_NAME(name) pthread_setname_np${mac}
+ ],
+ [if (SET_THREAD_NAME("conftest")) return 1;],
+ [rb_cv_func_pthread_setname_np_arguments="${mac}"
+ break])
+ done
+ ]
+ )
+ if test -n "${rb_cv_func_pthread_setname_np_arguments}"; then
+ AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np${rb_cv_func_pthread_setname_np_arguments})
+ else
+ AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), (void)0)
+ fi
+ fi
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then
diff --git a/thread_pthread.c b/thread_pthread.c
index aa8962a..aa2c49e 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1422,11 +1422,9 @@ timer_thread_sleep(rb_global_vm_lock_t* unused)
#endif /* USE_SLEEPY_TIMER_THREAD */
#if defined(__linux__) && defined(PR_SET_NAME)
+# undef SET_THREAD_NAME
# define SET_THREAD_NAME(name) prctl(PR_SET_NAME, name)
-#elif defined(HAVE_PTHREAD_SETNAME_NP)
-/* pthread_setname_np() on Darwin does not have target thread argument */
-# define SET_THREAD_NAME(name) pthread_setname_np(name)
-#else
+#elif !defined(SET_THREAD_NAME)
# define SET_THREAD_NAME(name) (void)0
#endif
diff --git a/version.h b/version.h
index 3e43f5d..a6b86f5 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-05-08"
-#define RUBY_PATCHLEVEL 94
+#define RUBY_PATCHLEVEL 95
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 5