ruby-changes:40785
From: nobu <ko1@a...>
Date: Wed, 2 Dec 2015 18:17:58 +0900 (JST)
Subject: [ruby-changes:40785] nobu:r52864 (trunk): thread.c: rb_thread_setname on OS X
nobu 2015-12-02 18:17:49 +0900 (Wed, 02 Dec 2015) New Revision: 52864 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52864 Log: thread.c: rb_thread_setname on OS X * thread.c (rb_thread_setname): pthread_setname_np() on OS X takes the name only and sets the current thread. Modified files: trunk/thread.c Index: thread.c =================================================================== --- thread.c (revision 52863) +++ thread.c (revision 52864) @@ -2774,13 +2774,17 @@ rb_thread_getname(VALUE thread) https://github.com/ruby/ruby/blob/trunk/thread.c#L2774 static VALUE rb_thread_setname(VALUE thread, VALUE name) { +#if defined(HAVE_PTHREAD_SETNAME_NP) || defined(HAVE_PTHREAD_SET_NAME_NP) const char *s = ""; +#endif rb_thread_t *th; GetThreadPtr(thread, th); if (!NIL_P(name)) { StringValueCStr(name); name = rb_str_new_frozen(name); +#if defined(HAVE_PTHREAD_SETNAME_NP) || defined(HAVE_PTHREAD_SET_NAME_NP) s = RSTRING_PTR(name); +#endif } th->name = name; #if defined(HAVE_PTHREAD_SETNAME_NP) @@ -2788,6 +2792,8 @@ rb_thread_setname(VALUE thread, VALUE na https://github.com/ruby/ruby/blob/trunk/thread.c#L2792 pthread_setname_np(th->thread_id, s); # elif defined(__NetBSD__) pthread_setname_np(th->thread_id, s, "%s"); +# elif defined(__APPLE__) + pthread_setname_np(s); # endif #elif defined(HAVE_PTHREAD_SET_NAME_NP) /* FreeBSD */ pthread_set_name_np(th->thread_id, s); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/