WIN-15.1: boehm-gc support for libgcj-win32 -- supersedes WIN-04, WIN-05, WIN-07, WIN-15
Adam Megacz
patches@lists.megacz.com
Wed Feb 6 19:55:00 GMT 2002
Committing as approved here:
http://gcc.gnu.org/ml/java-patches/2002-q1/msg00270.html
- a
2002-02-06 Adam Megacz <adam@xwt.org>
* boehm-gc/include/gc.h: (GC_CreateThread) This function is
now exposed on all Win32 platforms.
* boehm-gc/win32_threads.c: (GC_CreateThread) This now
compiles on Win32; it invokes CreateThread() if GC is built
as a DLL; otherwise it registers the thread.
* boehm-gc/misc.c (GC_init): Initialize GC_allocate_ml in case
libgcjgc was not built as a DLL.
Index: include/gc.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/gc.h,v
retrieving revision 1.7
diff -u -r1.7 gc.h
--- gc.h 2002/02/02 04:23:13 1.7
+++ gc.h 2002/02/07 03:55:16
@@ -849,10 +849,20 @@
#endif /* THREADS && !SRC_M3 */
-#if defined(GC_WIN32_THREADS) && defined(_WIN32_WCE)
+#if defined(GC_WIN32_THREADS)
# include <windows.h>
/*
+ * All threads must be created using GC_CreateThread, so that they will be
+ * recorded in the thread table.
+ */
+ HANDLE WINAPI GC_CreateThread(
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
+
+# if defined(_WIN32_WCE)
+ /*
* win32_threads.c implements the real WinMain, which will start a new thread
* to call GC_WinMain after initializing the garbage collector.
*/
@@ -861,22 +871,14 @@
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow );
-
- /*
- * All threads must be created using GC_CreateThread, so that they will be
- * recorded in the thread table.
- */
- HANDLE WINAPI GC_CreateThread(
- LPSECURITY_ATTRIBUTES lpThreadAttributes,
- DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
- LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
-# ifndef GC_BUILD
-# define WinMain GC_WinMain
-# define CreateThread GC_CreateThread
-# endif
+# ifndef GC_BUILD
+# define WinMain GC_WinMain
+# define CreateThread GC_CreateThread
+# endif
+# endif /* defined(_WIN32_WCE) */
-#endif
+#endif /* defined(GC_WIN32_THREADS) */
/*
* If you are planning on putting
Index: win32_threads.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/win32_threads.c,v
retrieving revision 1.7
diff -u -r1.7 win32_threads.c
--- win32_threads.c 2001/10/16 09:01:36 1.7
+++ win32_threads.c 2002/02/07 03:55:16
@@ -331,9 +331,19 @@
if (*lo < start) *lo = start;
}
+#if !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL))
-# ifdef MSWINCE
+HANDLE WINAPI GC_CreateThread(
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId )
+{
+ return CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress,
+ lpParameter, dwCreationFlags, lpThreadId);
+}
+#else /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL))
+
typedef struct {
HANDLE child_ready_h, parent_ready_h;
volatile struct thread_entry * entry;
@@ -450,6 +460,9 @@
return ret;
}
+#endif /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL))
+
+#ifdef MSWINCE
typedef struct {
HINSTANCE hInstance;
Index: misc.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
retrieving revision 1.18
diff -u -r1.18 misc.c
--- misc.c 2001/10/16 09:01:35 1.18
+++ misc.c 2002/02/07 03:55:16
@@ -436,6 +436,11 @@
DCL_LOCK_STATE;
DISABLE_SIGNALS();
+
+#ifdef MSWIN32
+ if (!GC_is_initialized) InitializeCriticalSection(&GC_allocate_ml);
+#endif /* MSWIN32 */
+
LOCK();
GC_init_inner();
UNLOCK();
More information about the Java-patches
mailing list