From 46655156dcc37509dcb69fcd0717c110eb1c624a Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Sat, 22 May 2021 21:36:27 +0900 Subject: Add Thread#native_thread_id [Feature #17853] --- thread_win32.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'thread_win32.c') diff --git a/thread_win32.c b/thread_win32.c index 8b5120be3c..fc31c09ec3 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -835,6 +835,14 @@ native_set_thread_name(rb_thread_t *th) { } +static VALUE +native_thread_native_thread_id(rb_thread_t *th) +{ + DWORD tid = GetThreadId(th->thread_id); + if (tid == 0) rb_sys_fail("GetThreadId"); + return ULONG2NUM(tid); +} + #if USE_MJIT static unsigned long __stdcall mjit_worker(void *arg) -- cgit v1.2.1