ruby-changes:31049
From: nobu <ko1@a...>
Date: Thu, 3 Oct 2013 10:37:06 +0900 (JST)
Subject: [ruby-changes:31049] nobu:r43128 (trunk): thread_pthread.c: set thread name
nobu 2013-10-03 10:37:00 +0900 (Thu, 03 Oct 2013) New Revision: 43128 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43128 Log: thread_pthread.c: set thread name * thread_pthread.c (thread_timer): set timer thread name on OSX too. Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 43127) +++ thread_pthread.c (revision 43128) @@ -1416,6 +1416,15 @@ timer_thread_sleep(rb_global_vm_lock_t* https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1416 } #endif /* USE_SLEEPY_TIMER_THREAD */ +#if defined(__linux__) && defined(PR_SET_NAME) +# define SET_THREAD_NAME(name) prctl(PR_SET_NAME, name) +#elif defined(__APPLE__) +/* pthread_setname_np() on Darwin does not have target thread argument */ +# define SET_THREAD_NAME(name) pthread_setname_np(name) +#else +# define SET_THREAD_NAME(name) (void)0 +#endif + static void * thread_timer(void *p) { @@ -1423,9 +1432,7 @@ thread_timer(void *p) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1432 if (TT_DEBUG) WRITE_CONST(2, "start timer thread\n"); -#if defined(__linux__) && defined(PR_SET_NAME) - prctl(PR_SET_NAME, "ruby-timer-thr"); -#endif + SET_THREAD_NAME("ruby-timer-thr"); #if !USE_SLEEPY_TIMER_THREAD native_mutex_initialize(&timer_thread_lock); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/