From b41c6771a3405eb9074651a7638639edbf662245 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 10 Aug 2014 11:47:09 +0400 Subject: [PATCH] Fix pthreads-win32 name in comments and documentation * configure.ac (GC_WIN32_PTHREADS): Fix pthreads-win32 name. * doc/README.macros (GC_WIN32_PTHREADS): Likewise. * doc/README.win32: Likewise. * include/gc.h (GC_WIN32_THREADS): Likewise. * include/gc_config_macros.h (GC_WIN32_PTHREADS): Likewise. * include/private/gc_locks.h (NUMERIC_THREAD_ID): Likewise. * win32_threads.c (GC_pthread_join): Likewise. * doc/README.win32: Add information how to build for Win32 with pthreads-win32 using configure. * include/private/gc_locks.h (NUMERIC_THREAD_ID): Adjust comment (capitalize 1st word of a sentence, add dot at sentence end). * win32_threads.c (GC_pthread_join): Join adjacent GC_WIN32_PTHREADS checks; refine comment about pthreads-win32 id. --- configure.ac | 4 ++-- doc/README.macros | 2 +- doc/README.win32 | 7 ++++--- include/gc.h | 2 +- include/gc_config_macros.h | 2 +- include/private/gc_locks.h | 8 ++++---- win32_threads.c | 11 +++++------ 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 32982b0f..fac8edd3 100644 --- a/configure.ac +++ b/configure.ac @@ -145,7 +145,7 @@ AH_TEMPLATE([GC_OPENBSD_THREADS], [Define to support OpenBSD pthreads.]) AH_TEMPLATE([GC_OSF1_THREADS], [Define to support Tru64 pthreads.]) AH_TEMPLATE([GC_SOLARIS_THREADS], [Define to support Solaris pthreads.]) AH_TEMPLATE([GC_WIN32_THREADS], [Define to support Win32 threads.]) -AH_TEMPLATE([GC_WIN32_PTHREADS], [Define to support win32-pthreads.]) +AH_TEMPLATE([GC_WIN32_PTHREADS], [Define to support pthreads-win32.]) AH_TEMPLATE([GC_RTEMS_PTHREADS], [Define to support rtems-pthreads.]) dnl System header feature requests. @@ -275,7 +275,7 @@ case "$THREADS" in ;; *-*-mingw*) AC_DEFINE(GC_WIN32_PTHREADS) - # Using win32-pthreads + # Using pthreads-win32 library. if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi diff --git a/doc/README.macros b/doc/README.macros index 6e381a61..96a41c76 100644 --- a/doc/README.macros +++ b/doc/README.macros @@ -149,7 +149,7 @@ GC_DGUX386_THREADS Enables support for DB/UX on I386 threads. GC_WIN32_THREADS Enables support for Win32 threads. That makes sense for this Makefile only under Cygwin. -GC_WIN32_PTHREADS Enables support for Ming32 pthreads. This cannot be +GC_WIN32_PTHREADS Enables support for pthreads-win32. This cannot be enabled automatically by GC_THREADS, which would assume Win32 native threads. diff --git a/doc/README.win32 b/doc/README.win32 index 5c30d896..134681cf 100644 --- a/doc/README.win32 +++ b/doc/README.win32 @@ -217,6 +217,7 @@ especially with the garbage collector. Any use is likely to provoke a crash in the GC, since it makes it impossible for the collector to correctly track threads. -To build the collector for Mingw32 Pthreads, use Makefile.direct and -explicitly set GC_WIN32_PTHREADS. Use -DPTW32_STATIC_LIB for the static -threads library. +To build the collector for MinGW pthreads-win32, +use Makefile.direct and explicitly set +GC_WIN32_PTHREADS (or pass --enable-threads=pthreads to configure). +Use -DPTW32_STATIC_LIB for the static threads library. diff --git a/include/gc.h b/include/gc.h index 52c82a05..f1051c97 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1480,7 +1480,7 @@ GC_API void GC_CALL GC_register_has_static_roots_callback( #if defined(GC_WIN32_THREADS) \ && (!defined(GC_PTHREADS) || defined(GC_BUILD) || defined(WINAPI)) - /* Note: for Cygwin and win32-pthread, this is skipped */ + /* Note: for Cygwin and pthreads-win32, this is skipped */ /* unless windows.h is included before gc.h. */ # if !defined(GC_NO_THREAD_DECLS) || defined(GC_BUILD) diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index 3c49fe08..ae970e12 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -58,7 +58,7 @@ #endif #if defined(GC_WIN32_PTHREADS) && !defined(GC_WIN32_THREADS) - /* Using pthreads-w32 library. */ + /* Using pthreads-win32 library. */ # define GC_WIN32_THREADS #endif diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index ba1f900c..964182af 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -83,19 +83,19 @@ /* structure. It also helps if comparisons don't involve a */ /* function call. Hence we introduce platform-dependent macros */ /* to compare pthread_t ids and to map them to integers. */ - /* the mapping to integers does not need to result in different */ + /* The mapping to integers does not need to result in different */ /* integers for each thread, though that should be true as much */ /* as possible. */ - /* Refine to exclude platforms on which pthread_t is struct */ + /* Refine to exclude platforms on which pthread_t is struct. */ # if !defined(GC_WIN32_PTHREADS) # define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) # define THREAD_EQUAL(id1, id2) ((id1) == (id2)) # define NUMERIC_THREAD_ID_UNIQUE # else # define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p)) - /* Using documented internal details of win32-pthread library. */ + /* Using documented internal details of pthreads-win32 library. */ /* Faster than pthread_equal(). Should not change with */ - /* future versions of win32-pthread library. */ + /* future versions of pthreads-win32 library. */ # define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) # undef NUMERIC_THREAD_ID_UNIQUE /* Generic definitions based on pthread_equal() always work but */ diff --git a/win32_threads.c b/win32_threads.c index df11a5e7..73ba0ff2 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -2463,15 +2463,14 @@ GC_INNER void GC_thr_init(void) # ifndef GC_WIN32_PTHREADS while ((t = GC_lookup_pthread(pthread_id)) == 0) Sleep(10); -# endif - - result = pthread_join(pthread_id, retval); - -# ifdef GC_WIN32_PTHREADS - /* win32_pthreads id are unique */ + result = pthread_join(pthread_id, retval); +# else + result = pthread_join(pthread_id, retval); + /* pthreads-win32 id are unique (not recycled) */ t = GC_lookup_pthread(pthread_id); if (NULL == t) ABORT("Thread not registered"); # endif + LOCK(); GC_delete_gc_thread_no_free(t); GC_INTERNAL_FREE(t); -- 2.40.0