PATCH: Remove special case for GC_FREEBSD_THREADS.
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Tue Oct 9 10:22:00 GMT 2001
This patch reverts -r1.15 of linux_threads.c (which was part of a
multi-file patch). The correct fix is now in the OS code base and is
being moved to the STABLE branch. Now that I understand the root
problem (a race between signal handling and the exit/join mechanism)
and how it produced not only this symptom but also the 1 in 5 deadlock
situation I reported as well, it seems better to actually let the
boehm-gc test case fail instead of papering over it as I did with this
workaround.
Bootstrapped on i386-*-freebsd4.4 (with OS patch to be in 4.5 release).
In the interest of tidying up the code base (and promoting the failure
that signals a real problem), permission to apply to gcc mainline?
[Hans, this also works against your recently released gc6.1alpha2. I
can confirm it works nicely on FreeBSD 4.X and 5.X without any patches.]
* linux_threads.c (WRAP_FUNC(pthread_join)): Remove special
case for GC_FREEBSD_THREADS.
* configure.in (*-*-freebsd*): Clarify warning.
* configure: Rebuilt.
Index: linux_threads.c
===================================================================
RCS file: /cvs/gcc/egcs/boehm-gc/linux_threads.c,v
retrieving revision 1.16
diff -c -r1.16 linux_threads.c
*** linux_threads.c 2001/10/23 00:28:56 1.16
--- linux_threads.c 2001/11/20 08:01:21
***************
*** 1268,1284 ****
/* cant have been recycled by pthreads. */
UNLOCK();
result = REAL_FUNC(pthread_join)(thread, retval);
- # if defined (GC_FREEBSD_THREADS)
- /* On FreeBSD, the wrapped pthread_join() sometimes returns (what
- appears to be) a spurious EINTR which caused the test and real code
- to gratuitously fail. Having looked at system pthread library source
- code, I see how this return code may be generated. In one path of
- code, pthread_join() just returns the errno setting of the thread
- being joined. This does not match the POSIX specification or the
- local man pages thus I have taken the liberty to catch this one
- spurious return value properly conditionalized on GC_FREEBSD_THREADS. */
- if (result == EINTR) result = 0;
- # endif
if (result == 0) {
LOCK();
/* Here the pthread thread id may have been recycled. */
--- 1268,1273 ----
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/boehm-gc/configure.in,v
retrieving revision 1.34
diff -c -r1.34 configure.in
*** configure.in 2001/10/16 09:01:35 1.34
--- configure.in 2001/11/20 09:09:09
***************
*** 90,96 ****
THREADLIBS="-lpthread -lrt"
;;
*-*-freebsd*)
! AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
AC_DEFINE(GC_FREEBSD_THREADS)
INCLUDES="$INCLUDES -pthread"
THREADLIBS=-pthread
--- 90,97 ----
THREADLIBS="-lpthread -lrt"
;;
*-*-freebsd*)
! AC_MSG_WARN("Threaded GC is prone to deadlock before FreeBSD 4.5.")
! AC_MSG_WARN("Related symptom is pthread_join returns spurious EINTR.")
AC_DEFINE(GC_FREEBSD_THREADS)
INCLUDES="$INCLUDES -pthread"
THREADLIBS=-pthread
More information about the Java-patches
mailing list