aboutsummaryrefslogtreecommitdiffstats
path: root/thread_win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-26 00:30:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-26 00:30:03 +0000
commit19d692920d2d207c3aa891fc79aa5a93c17f84c6 (patch)
tree123927bc19e68863da3b0ba2a1fb8c0bbed106de /thread_win32.c
parentc150c7877dc704efe369976231c97e3823084191 (diff)
downloadruby-19d692920d2d207c3aa891fc79aa5a93c17f84c6.tar.gz
thread_win32.c: set thread name
* thread_win32.c (native_set_another_thread_name): set thread name by SetThreadDescription. * win32/win32.c (rb_w32_set_thread_description): dynamically try SetThreadDescription. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/thread_win32.c b/thread_win32.c
index d5a7ff4581..5b42310679 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -669,6 +669,10 @@ ubf_handle(void *ptr)
}
}
+int rb_w32_set_thread_description(HANDLE th, const WCHAR *name);
+int rb_w32_set_thread_description_str(HANDLE th, VALUE name);
+#define native_set_another_thread_name rb_w32_set_thread_description_str
+
static struct {
HANDLE id;
HANDLE lock;
@@ -679,6 +683,7 @@ static unsigned long __stdcall
timer_thread_func(void *dummy)
{
thread_debug("timer_thread\n");
+ rb_w32_set_thread_description(GetCurrentThread(), L"ruby-timer-thread");
while (WaitForSingleObject(timer_thread.lock, TIME_QUANTUM_USEC/1000) ==
WAIT_TIMEOUT) {
timer_thread_function(dummy);