diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-06-01 22:27:13 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-06-01 22:27:13 +0900 |
commit | 9024c7f1bb3ea432a2b52e7c701b06f83aafd4d5 (patch) | |
tree | 0b52d7bc67fde0fcfd4fb30bd2f91c121b0e7b49 /thread_pthread.c | |
parent | 6e7e9a80adfe69e6e6d20e01997b97a5c24cd33e (diff) |
Make `Thread#native_thread_id` not-implemented if unsupported
Raise `NotImplementedError` on unsupported platforms regardless
the argument consistently.
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 87db59e638..8e983076b6 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1726,13 +1726,10 @@ native_set_another_thread_name(rb_nativethread_id_t thread_id, VALUE name) #endif } +#if defined(RB_THREAD_T_HAS_NATIVE_ID) || defined(__APPLE__) static VALUE native_thread_native_thread_id(rb_thread_t *target_th) { -#if !defined(RB_THREAD_T_HAS_NATIVE_ID) && !defined(__APPLE__) - rb_notimplement(); -#endif - #ifdef RB_THREAD_T_HAS_NATIVE_ID int tid = target_th->tid; if (tid == 0) return Qnil; @@ -1744,6 +1741,10 @@ native_thread_native_thread_id(rb_thread_t *target_th) return ULL2NUM((unsigned long long)tid); #endif } +# define USE_NATIVE_THREAD_NATIVE_THREAD_ID 1 +#else +# define USE_NATIVE_THREAD_NATIVE_THREAD_ID 0 +#endif static void ubf_timer_invalidate(void) |