This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH]: natThread.cc: Destroy join sync objects in finalizer
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 10 Sep 2004 07:50:37 -0500
- Subject: [PATCH]: natThread.cc: Destroy join sync objects in finalizer
- Reply-to: gnustuff at thisiscool dot com
Hi People,
The GC finalizer finalize_native in natThread.cc should destroy
the join synchronization objects if the target platform supports
these destruction operations (which isn't the case for Linux and
-DLINUX_THREADS but is the case for Win32).
I nevertheless ran the libjava testsuite and Mauve for i686-pc-linux-gnu
and (as expected) there were no differences between the pre-patch and
post-patch outcomes.
Note that with this patch, there's still a bug in the MinGW port
because _Jv_HaveCondDestroy is not defined in win32-threads.h.
That's fixed in a patch I'll submit shortly.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
2004-09-10 Mohan Embar <gnustuff@thisiscool.com>
* java/lang/natThread.cc (finalize_native): Destroy
join conditional variable and mutex if these destroy
operations are supported.
Index: java/lang/natThread.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natThread.cc,v
retrieving revision 1.27
diff -u -2 -r1.27 natThread.cc
--- java/lang/natThread.cc 28 May 2004 18:53:04 -0000 1.27
+++ java/lang/natThread.cc 8 Sep 2004 13:13:09 -0000
@@ -79,4 +79,10 @@
natThread *nt = (natThread *) ptr;
_Jv_ThreadDestroyData (nt->thread);
+#ifdef _Jv_HaveCondDestroy
+ _Jv_CondDestroy (&nt->join_cond);
+#endif
+#ifdef _Jv_HaveMutexDestroy
+ _Jv_MutexDestroy (&nt->join_mutex);
+#endif
}