From: Ivan Maidanski Date: Sun, 10 Aug 2014 07:47:09 +0000 (+0400) Subject: Fix pthreads-win32 name in comments and documentation X-Git-Tag: gc7_4_4~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac583b81a17155307fbb82f1c49d257f87bc3028;p=gc Fix pthreads-win32 name in comments and documentation (Apply commit b41c677 from 'master' branch.) * 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. --- diff --git a/configure.ac b/configure.ac index 6b74071c..a659014c 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 fcc7e970..a836767d 100644 --- a/doc/README.macros +++ b/doc/README.macros @@ -145,7 +145,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 9d955d65..f08a0b40 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1472,7 +1472,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 f6db93a4..70fd67df 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 e58d14ca..8ea48804 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)(word)(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 bb15259c..ff97f292 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -2465,15 +2465,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);