1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2015-06-11 06:56:57 +00:00
parent 5421cea252
commit 370bd884bc
3 changed files with 17 additions and 6 deletions

View file

@ -1,3 +1,14 @@
Thu Jun 11 15:14:16 2015 NARUSE, Yui <naruse@ruby-lang.org>
* 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@atdot.net>
* method.h (METHOD_ENTRY_BASIC_SET): should clear last bit.

View file

@ -2739,7 +2739,7 @@ if test x"$enable_pthread" = xyes; then
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
)
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

View file

@ -1486,14 +1486,12 @@ timer_thread_sleep(rb_global_vm_lock_t* unused)
#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)
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);