From e55eb9c8c52f9e38dcf9a3b35d6bf9ba0a4f7e48 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 25 Aug 2005 13:48:41 +0000 Subject: [PATCH] 2005-08-24 Zoltan Varga * win32_threads.c: If GC_INSIDE_DLL is defined, define the DllMain function for automatic registration of threads with the GC. * configure.in: Add an option for turning GC_INSIDE_DLL on. svn path=/trunk/mono/; revision=48831 --- ChangeLog | 7 +++++++ configure.in | 7 +++++++ win32_threads.c | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f32a20cb..442378cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2005-08-24 Zoltan Varga + * win32_threads.c: If GC_INSIDE_DLL is defined, define the DllMain function for automatic registration + of threads with the GC. + + * configure.in: Add an option for turning GC_INSIDE_DLL on. + +2005-08-25 Zoltan Varga + * solaris_threads.c (GC_thread_register_foreign): Add dummy implementation. Mon Aug 22 10:41:41 BST 2005 Paolo Molaro diff --git a/configure.in b/configure.in index 066f2d64..2e57f2a6 100644 --- a/configure.in +++ b/configure.in @@ -49,6 +49,10 @@ esac THREADS=$with_libgc_threads +AC_ARG_ENABLE(win32-dllmain, +[ --enable-win32-dllmain Define the DllMain function in win32_threads.c even if the collector is not built as a dll], +) + AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark parallelize marking and free list construction], [case "$THREADS" in @@ -169,6 +173,9 @@ case "$THREADS" in AC_DEFINE(GC_WIN32_THREADS) dnl Wine getenv may not return NULL for missing entry AC_DEFINE(NO_GETENV) + if test "${enable_win32_dllmain}" = yes; then + AC_DEFINE(GC_INSIDE_DLL) + fi ;; dgux386) THREADS=dgux386 diff --git a/win32_threads.c b/win32_threads.c index 681e1c2b..3195094c 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -74,7 +74,13 @@ extern LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info); int GC_thread_is_registered (void) { +#if defined(GC_DLL) || defined(GC_INSIDE_DLL) + /* Registered by DllMain */ return 1; +#else + /* FIXME: */ + return 0; +#endif } /* @@ -753,7 +759,7 @@ int GC_pthread_detach(pthread_t thread) * We avoid acquiring locks here, since this doesn't seem to be preemptable. * Pontus Rydin suggests wrapping the thread start routine instead. */ -#ifdef GC_DLL +#if defined(GC_DLL) || defined(GC_INSIDE_DLL) BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved) { switch (reason) { -- 2.40.0