Multiple threads fixes, nogc fix

Bryce McKinlay bryce@albatross.co.nz
Sat Dec 30 04:09:00 GMT 2000


These patches fix several long-standing and nasty threads problems:

1. We never detached dead threads. This meant that native thread
resources were leaked, which under linux meant that only ~1020 threads
could ever be created during the lifetime of a java process. Oops ;-)

2. The native thread data for posix threads was allocated using C++
"new" but never released (there were FIXMEs about this problem). My
solution registers a finalizer against the natThread struct rather than
the java Thread object itself, ensuring that the thread data will only
be released after the Thread object is definitely unreachable, after any
user Thread finalizers have run (the natThread struct is stored in an
Object field, so is marked in the regular way via the thread object). I
also removed the LINUX_THREADS conditional code from around the mutex
and condvar destroy calls (thread cleanup isn't time critical and nobody
likes unnecessary #ifdefs).

3. Previously mentioned linuxthreads symbol version/link problems, fixed
by linking the boehm-gc library with -lpthread.

4. In the case of a catastrophic runtime failure, zombie threads would
sometimes get left behind because the GC blocked delivery of
SIGABRT during collections.

Also, nogc.cc didn't build.

regards

  [ bryce ]




More information about the Java-patches mailing list