]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gc.h: (GC_CreateThread) This function is now exposed on all Win32 platforms.
authorAdam Megacz <adam@xwt.org>
Thu, 7 Feb 2002 03:56:40 +0000 (03:56 +0000)
committerAdam Megacz <megacz@gcc.gnu.org>
Thu, 7 Feb 2002 03:56:40 +0000 (03:56 +0000)
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.

From-SVN: r49563

boehm-gc/ChangeLog
boehm-gc/include/gc.h
boehm-gc/misc.c
boehm-gc/win32_threads.c

index 90dfa7c14f4c3eb6a9aca0725fae37dad61289e1..e167429a413506db68f5430ef20a521ede11d038 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2002-02-01  Adam Megacz <adam@xwt.org>
 
        * boehm-gc on win32 now automatically detects if it is being built
index 469242512016dd850f3c2121b3591eed05eb12fa..9e5447b045838bb6fc04ff3a4ae5c3d339b71735 100644 (file)
@@ -849,9 +849,19 @@ extern void GC_thr_init(); /* Needed for Solaris/X86       */
 
 #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.
@@ -862,21 +872,13 @@ extern void GC_thr_init();        /* Needed for Solaris/X86       */
       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 2bb93f3dd57c79505817065dfa0e6d9c22b6cc0d..06d7085d06eff37536bf431371714021425fc986 100644 (file)
@@ -436,6 +436,11 @@ void GC_init()
     DCL_LOCK_STATE;
     
     DISABLE_SIGNALS();
+
+#ifdef MSWIN32
+    if (!GC_is_initialized) InitializeCriticalSection(&GC_allocate_ml);
+#endif /* MSWIN32 */
+
     LOCK();
     GC_init_inner();
     UNLOCK();
index 533b6a4dd9ea8952a2414881235bf9578e7bb0de..33facbbaa10f0fc29f0635d29d683a188811b249 100644 (file)
@@ -331,8 +331,18 @@ void GC_get_next_stack(char *start, char **lo, char **hi)
     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;
@@ -450,6 +460,9 @@ static DWORD WINAPI thread_start(LPVOID arg)
 
     return ret;
 }
+#endif /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL)) 
+
+#ifdef MSWINCE
 
 typedef struct {
     HINSTANCE hInstance;