diff options
author | Koichi Sasada <[email protected]> | 2022-05-24 02:56:59 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2022-05-24 10:06:51 +0900 |
commit | d9984f39d32f4cd692a35f4d803f7754ea262805 (patch) | |
tree | 935aa00da1be80acd99b25dfb7e5e845020ca70d /thread_pthread.c | |
parent | 741ac503309f32b5c39073f46a205c99a31d4b0e (diff) |
remove `NON_SCALAR_THREAD_ID` support
`NON_SCALAR_THREAD_ID` shows `pthread_t` is non-scalar (non-pointer)
and only s390x is known platform. However, the supporting code is
very complex and it is only used for deubg print information.
So this patch removes the support of `NON_SCALAR_THREAD_ID`
and make the code simple.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5933
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index c825b731a6..c189a8130c 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -51,10 +51,15 @@ # define USE_EVENTFD (0) #endif +#ifdef NON_SCALAR_THREAD_ID + #define DEBUG_OUT_NT_ID (NULL) +#else + #define DEBUG_OUT_NT_ID ((void *)pthread_self()) +#endif + #define DEBUG_OUT() \ pthread_mutex_lock(&debug_mutex); \ - printf(POSITION_FORMAT"%"PRI_THREAD_ID" - %s" POSITION_ARGS, \ - fill_thread_id_string(pthread_self(), thread_id_string), buf); \ + printf(POSITION_FORMAT"%"PRI_THREAD_ID" - %s" POSITION_ARGS, DEBUG_OUT_NT_ID, buf); \ fflush(stdout); \ pthread_mutex_unlock(&debug_mutex); @@ -717,7 +722,6 @@ Init_native_thread(rb_thread_t *main_th) // setup main thread main_th->nt->thread_id = pthread_self(); ruby_thread_set_native(main_th); - fill_thread_id_str(main_th); native_thread_init(main_th->nt); } @@ -1069,7 +1073,6 @@ thread_start_func_1(void *th_ptr) VALUE stack_start; #endif - fill_thread_id_str(th); #if defined USE_NATIVE_THREAD_INIT native_thread_init_stack(th); #endif @@ -1173,7 +1176,6 @@ use_cached_thread(rb_thread_t *th) entry->th = th; /* th->nt->thread_id must be set before signal for Thread#name= */ th->nt->thread_id = entry->thread_id; - fill_thread_id_str(th); rb_native_cond_signal(&entry->cond); } rb_native_mutex_unlock(&thread_cache_lock); @@ -1237,7 +1239,6 @@ native_thread_create(rb_thread_t *th) err = pthread_create(&th->nt->thread_id, &attr, thread_start_func_1, th); thread_debug("create: %p (%d)\n", (void *)th, err); /* should be done in the created thread */ - fill_thread_id_str(th); CHECK_ERR(pthread_attr_destroy(&attr)); } return err; |