mingw, gcj, threads [committed]
Adam Megacz
gcj@lists.megacz.com
Sat Mar 9 14:38:00 GMT 2002
Adam Megacz <gcj@lists.megacz.com> writes:
> My solution is to include CRT_MT in win32.cc, so that I don't have
> to touch/patch any of the code in gcc/gcc/, and so I don't step on
> the mingw folks' toes. I'll also include (in win32.cc) a fake
> verison of the function that registers a TLS entry for deallocation,
> and deallocate them in _Jv_ThreadUnRegister.
After discussion on java@gcc.gnu.org and the Mingw-Dvlpr lists, the
consensus is that this will work. Committed as shown below, branch and
trunk.
- a
2002年03月09日 Adam Megacz <adam@xwt.org>
* win32.cc (_CRT_MT, __mingwthr_key_dtor) Added fake
definitions to simulate -mthreads.
Index: win32.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/win32.cc,v
retrieving revision 1.4.8.2
diff -u -r1.4.8.2 win32.cc
--- win32.cc 2002年03月09日 22:08:41 1.4.8.2
+++ win32.cc 2002年03月09日 22:28:03
@@ -48,3 +48,17 @@
return t.time * 1000LL + t.millitm;
}
+// The following definitions "fake out" mingw to think that -mthreads
+// was enabled and that mingwthr.dll was linked. GCJ-compiled
+// applications don't need this helper library because we can safely
+// detect thread death (return from Thread.run()).
+
+int _CRT_MT = 1;
+
+extern "C" int
+__mingwthr_key_dtor (DWORD, void (*) (void *))
+{
+ // FIXME: for now we do nothing; this causes a memory leak of
+ // approximately 24 bytes per thread created.
+ return 0;
+}
More information about the Java
mailing list