Commit b1d24685 by Adam Megacz Committed by Adam Megacz

gc.h: (GC_CreateThread) This function is now exposed on all Win32 platforms.

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
parent b5ee195f
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> 2002-02-01 Adam Megacz <adam@xwt.org>
* boehm-gc on win32 now automatically detects if it is being built * boehm-gc on win32 now automatically detects if it is being built
......
...@@ -849,10 +849,20 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */ ...@@ -849,10 +849,20 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */ #endif /* THREADS && !SRC_M3 */
#if defined(GC_WIN32_THREADS) && defined(_WIN32_WCE) #if defined(GC_WIN32_THREADS)
# include <windows.h> # 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 * win32_threads.c implements the real WinMain, which will start a new thread
* to call GC_WinMain after initializing the garbage collector. * to call GC_WinMain after initializing the garbage collector.
*/ */
...@@ -862,21 +872,13 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */ ...@@ -862,21 +872,13 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */
LPWSTR lpCmdLine, LPWSTR lpCmdLine,
int nCmdShow ); int nCmdShow );
/* # ifndef GC_BUILD
* All threads must be created using GC_CreateThread, so that they will be # define WinMain GC_WinMain
* recorded in the thread table. # define CreateThread GC_CreateThread
*/ # endif
HANDLE WINAPI GC_CreateThread( # endif /* defined(_WIN32_WCE) */
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
#endif #endif /* defined(GC_WIN32_THREADS) */
/* /*
* If you are planning on putting * If you are planning on putting
......
...@@ -436,6 +436,11 @@ void GC_init() ...@@ -436,6 +436,11 @@ void GC_init()
DCL_LOCK_STATE; DCL_LOCK_STATE;
DISABLE_SIGNALS(); DISABLE_SIGNALS();
#ifdef MSWIN32
if (!GC_is_initialized) InitializeCriticalSection(&GC_allocate_ml);
#endif /* MSWIN32 */
LOCK(); LOCK();
GC_init_inner(); GC_init_inner();
UNLOCK(); UNLOCK();
......
...@@ -331,8 +331,18 @@ void GC_get_next_stack(char *start, char **lo, char **hi) ...@@ -331,8 +331,18 @@ void GC_get_next_stack(char *start, char **lo, char **hi)
if (*lo < start) *lo = start; 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 { typedef struct {
HANDLE child_ready_h, parent_ready_h; HANDLE child_ready_h, parent_ready_h;
...@@ -450,6 +460,9 @@ static DWORD WINAPI thread_start(LPVOID arg) ...@@ -450,6 +460,9 @@ static DWORD WINAPI thread_start(LPVOID arg)
return ret; return ret;
} }
#endif /* !defined(MSWINCE) && !(defined(__MINGW32__) && !defined(_DLL))
#ifdef MSWINCE
typedef struct { typedef struct {
HINSTANCE hInstance; HINSTANCE hInstance;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment