diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-03-04 00:11:41 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-03-04 00:11:41 +0300 |
commit | 6a283de1db84c15e048cf9df6b47f4368b2e226a (patch) | |
tree | 28942acabd9eeebb00eae2cdd27b43bd16da508d /include | |
parent | ce77122ae1cb549833970189889f79d7fc8b8b6d (diff) | |
download | bdwgc-6a283de1db84c15e048cf9df6b47f4368b2e226a.tar.gz |
Define GC_self_thread_inner to lookup GC_thread of current thread
(refactoring)
* include/private/pthread_support.h (GC_self_thread_inner): New macro.
* pthread_stop_world.c (GC_lookup_thread_async): Replace to no-arg
GC_lookup_self_thread_async(); update comment.
* pthread_stop_world.c (GC_suspend_handler_inner): Remove self local
variable, use pthread_self() instead.
* pthread_stop_world.c [NACL] (__nacl_suspend_thread_if_needed):
Likewise.
* pthread_stop_world.c (GC_suspend_handler_inner): Call
GC_lookup_self_thread_async() instead of GC_lookup_thread_async(self).
* pthread_stop_world.c [NACL] (GC_nacl_shutdown_gc_thread): Do not use
GC_lookup_thread(pthread_self()) in assertion.
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (GC_self_thread): New STATIC function.
* pthread_support.c [!GC_NO_FINALIZATION] (GC_reset_finalizer_nested):
Remove me local variable.
* pthread_support.c [!GC_NO_FINALIZATION] (GC_reset_finalizer_nested,
GC_check_finalizer_nested): Call GC_self_thread_inner() instead of
GC_lookup_thread(thread_id_self()).
* pthread_support.c [!GC_WIN32_THREADS] (GC_register_altstack,
GC_thr_init): Likewise.
* pthread_support.c [THREAD_LOCAL_ALLOC] (GC_init_parallel): Likewise.
* pthread_support.c (GC_do_blocking_inner, GC_set_stackbottom,
GC_get_stackbottom, GC_call_with_gc_active, GC_unregister_my_thread,
GC_register_my_thread): Likewise.
* pthread_support.c [GC_HAVE_PTHREAD_EXIT] (GC_pthread_exit): Likewise.
* pthread_support.c [GC_ASSERTIONS && THREAD_LOCAL_ALLOC]
(GC_is_thread_tsd_valid): Use GC_self_thread() instead of locking and
GC_lookup_thread(thread_id_self()).
* pthread_support.c (GC_thread_is_registered): Likewise.
* pthread_support.c [GC_ASSERTIONS] (GC_allow_register_threads):
Likewise.
* pthread_support.c (GC_thread_is_registered, GC_get_stackbottom,
GC_call_with_gc_active, GC_unregister_my_thread,
GC_register_my_thread): Remove self_id local variable.
* pthread_support.c [!GC_WIN32_THREADS] (GC_register_altstack,
GC_thr_init): Likewise.
* pthread_support.c [GC_HAVE_PTHREAD_EXIT] (GC_pthread_exit): Likewise.
Diffstat (limited to 'include')
-rw-r--r-- | include/private/pthread_support.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/private/pthread_support.h b/include/private/pthread_support.h index 165c212a..dab3738b 100644 --- a/include/private/pthread_support.h +++ b/include/private/pthread_support.h @@ -382,6 +382,8 @@ GC_EXTERN GC_thread GC_threads[THREAD_TABLE_SZ]; #endif /* GC_PTHREADS */ GC_INNER GC_thread GC_lookup_thread(thread_id_t); +#define GC_self_thread_inner() GC_lookup_thread(thread_id_self()) + GC_INNER void GC_wait_for_gc_completion(GC_bool); #ifdef NACL |