summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-31 18:50:45 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-12-31 18:50:45 +0300
commit2cd04cd95cef35180a021e83f7fb9ac268e6ab3b (patch)
treeea7fcf9f4f3635bf412c448aaac49800b75d65a3 /include
parent40b23a42c73ed11d384a5ed81e8f5eb126edb434 (diff)
downloadbdwgc-2cd04cd95cef35180a021e83f7fb9ac268e6ab3b.tar.gz
Uniform use of GC_lookup_by_pthread in GC_pthread_join/detach
(refactoring) * include/private/pthread_support.h [GC_WIN32_THREADS && GC_PTHREADS] (GC_lookup_by_pthread): Move declaration down. * include/private/pthread_support.h [GC_PTHREADS && !GC_WIN32_THREADS] (GC_lookup_by_pthread): Define as macro (to GC_lookup_thread). * pthread_stop_world.c [!NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Use GC_lookup_by_pthread() instead of GC_lookup_thread(). * pthread_support.c [!GC_NO_PTHREAD_CANCEL && GC_PTHREADS && CANCEL_SAFE] (GC_pthread_cancel): Likewise. * pthread_support.c [GC_PTHREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2] (GC_pthread_join, GC_pthread_detach): Likewise. * pthread_support.c [GC_PTHREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && GC_WIN32_THREADS] (GC_pthread_join, GC_pthread_detach): Wrap GC_lookup_by_pthread() call into LOCK/UNLOCK. * win32_threads.c [GC_PTHREADS] (GC_lookup_by_pthread): Refine comment; define id local variable; remove hv_guess local variable; replace break with return p; remove LOCK() and UNLOCK(); add assertion that the GC lock is held.
Diffstat (limited to 'include')
-rw-r--r--include/private/pthread_support.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/private/pthread_support.h b/include/private/pthread_support.h
index aefd6b6b..042402c1 100644
--- a/include/private/pthread_support.h
+++ b/include/private/pthread_support.h
@@ -331,7 +331,6 @@ GC_EXTERN GC_thread GC_threads[THREAD_TABLE_SZ];
thread_id_t self_id);
# ifdef GC_PTHREADS
- GC_INNER GC_thread GC_lookup_by_pthread(pthread_t);
GC_INNER void GC_win32_cache_self_pthread(thread_id_t);
# else
GC_INNER void GC_delete_thread(GC_thread);
@@ -370,6 +369,11 @@ GC_EXTERN GC_thread GC_threads[THREAD_TABLE_SZ];
# define GC_PTHREAD_PTRVAL(pthread_id) pthread_id.p
# else
# define GC_PTHREAD_PTRVAL(pthread_id) pthread_id
+# endif /* !GC_WIN32_THREADS || CYGWIN32 */
+# ifdef GC_WIN32_THREADS
+ GC_INNER GC_thread GC_lookup_by_pthread(pthread_t);
+# else
+# define GC_lookup_by_pthread(t) GC_lookup_thread(t)
# endif
#endif /* GC_PTHREADS */