Actions
Feature #11251
closedThread#name and Thread#name=
Status:
Closed
Assignee:
-
Target version:
-
Description
Threadの名前の取得・設定を行うAPIを追加しませんか。
#6694 や #6695 などで断続的に議論がなされ、r47670 で一部自動で名前が付けられるようになったりもしていますが、
Rubyレベルでそれを見る手段は提供されていませんし、明示的に付けることも出来ません。
今でもニーズは結構あるようです。
"Fluentdでどのスレッドがどのプラグインに属しているのかが簡単に分かるようになるんですよね”
https://twitter.com/repeatedly/status/608855851131011073
"確かにRubyのスレッドに名前付けられたら良さそう。主にログで識別する用途で。"
https://twitter.com/frsyuki/status/608863065598140417
Linux (glibc 2.12+)
int pthread_setname_np(pthread_t thread, const char *name);
int pthread_getname_np(pthread_t thread, char *name, size_t len);
FreeBSD
void pthread_set_name_np(pthread_t, const char *);
NetBSD
int pthread_getname_np(pthread_t thread, char *name, size_t len);
int pthread_setname_np(pthread_t thread, const char *name, void *arg);
http://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current
OS X
/usr/include/pthread/pthread.h:int pthread_getname_np(pthread_t,char*,size_t);
/usr/include/pthread/pthread.h:int pthread_setname_np(const char*);
Updated by nobu (Nobuyoshi Nakada) over 9 years ago
- Description updated (diff)
Updated by naruse (Yui NARUSE) over 9 years ago
- Related to Feature #6694: Thread.new without block. added
Updated by naruse (Yui NARUSE) over 9 years ago
- Related to Feature #6695: Configuration for Thread/Fiber creation added
Updated by matz (Yukihiro Matsumoto) over 9 years ago
いいよ。
Having Thread#name and Thread#name= is OK for me. Concrete behavior should be implementation defined.
Matz.
Updated by naruse (Yui NARUSE) over 9 years ago
- Status changed from Open to Closed
Updated by naruse (Yui NARUSE) over 3 years ago
- Related to Feature #17853: Add Thread#thread_id added
Actions
Like0
Like0Like0Like0Like0Like0Like0