[前][次][番号順一覧][スレッド一覧]

ruby-changes:38750

From: naruse <ko1@a...>
Date: Thu, 11 Jun 2015 15:57:11 +0900 (JST)
Subject: [ruby-changes:38750] naruse:r50831 (trunk): * configure.in: define SET_THREAD_NAME if it has pthread_set_name_np

naruse	2015-06-11 15:56:57 +0900 (Thu, 11 Jun 2015)

  New Revision: 50831

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50831

  Log:
    * configure.in: define SET_THREAD_NAME if it has pthread_set_name_np
      for FreeBSD, and don't define it if both pthread_setname_np
      and pthread_set_name_np don't exist.
    
    * thread_pthread.c (SET_THREAD_NAME): don't define if they don't exist.
    
    * thread_pthread.c (native_set_thread_name): run if SET_THREAD_NAME
      is defined.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/thread_pthread.c
Index: configure.in
===================================================================
--- configure.in	(revision 50830)
+++ configure.in	(revision 50831)
@@ -2739,7 +2739,7 @@ if test x"$enable_pthread" = xyes; then https://github.com/ruby/ruby/blob/trunk/configure.in#L2739
 	pthread_get_stackaddr_np pthread_get_stacksize_np \
 	thr_stksegment pthread_stackseg_np pthread_getthrds_np \
 	pthread_cond_init pthread_condattr_setclock pthread_condattr_init \
-	pthread_sigmask pthread_setname_np)
+	pthread_sigmask pthread_setname_np pthread_set_name_np)
     if test "${host_os}" = "nacl"; then
       ac_cv_func_pthread_attr_init=no
     else
@@ -2771,9 +2771,9 @@ if test x"$enable_pthread" = xyes; then https://github.com/ruby/ruby/blob/trunk/configure.in#L2771
 	)
 	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
+    elif test "$ac_cv_func_pthread_set_name_np" = yes; then
+	    AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_set_name_np(pthread_self(), name))
     fi
 fi
 if test x"$ac_cv_header_ucontext_h" = xyes; then
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50830)
+++ ChangeLog	(revision 50831)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 11 15:14:16 2015  NARUSE, Yui  <naruse@r...>
+
+	* configure.in: define SET_THREAD_NAME if it has pthread_set_name_np
+	  for FreeBSD, and don't define it if both pthread_setname_np
+	  and pthread_set_name_np don't exist.
+
+	* thread_pthread.c (SET_THREAD_NAME): don't define if they don't exist.
+
+	* thread_pthread.c (native_set_thread_name): run if SET_THREAD_NAME
+	  is defined.
+
 Thu Jun 11 15:53:31 2015  Koichi Sasada  <ko1@a...>
 
 	* method.h (METHOD_ENTRY_BASIC_SET): should clear last bit.
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 50830)
+++ thread_pthread.c	(revision 50831)
@@ -1486,14 +1486,12 @@ timer_thread_sleep(rb_global_vm_lock_t* https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1486
 #if defined(__linux__) && defined(PR_SET_NAME)
 # undef SET_THREAD_NAME
 # define SET_THREAD_NAME(name) prctl(PR_SET_NAME, name)
-#elif !defined(SET_THREAD_NAME)
-# define SET_THREAD_NAME(name) (void)0
 #endif
 
 static void
 native_set_thread_name(rb_thread_t *th)
 {
-#if defined(__linux__) && defined(PR_SET_NAME)
+#ifdef SET_THREAD_NAME
     if (!th->first_func && th->first_proc) {
 	VALUE loc = rb_proc_location(th->first_proc);
 	if (!NIL_P(loc)) {
@@ -1529,7 +1527,9 @@ thread_timer(void *p) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1527
 
     if (TT_DEBUG) WRITE_CONST(2, "start timer thread\n");
 
+#ifdef SET_THREAD_NAME
     SET_THREAD_NAME("ruby-timer-thr");
+#endif
 
 #if !USE_SLEEPY_TIMER_THREAD
     native_mutex_initialize(&timer_thread_lock);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]