From 96e603105856ffc538a9505df242e1823194e560 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 15 Nov 2011 20:29:45 +0400 Subject: [PATCH] Support GC_Create/ExitThread, GC_begin/endthreadex for Cygwin and win32-pthread * include/gc.h (GC_CreateThread, GC_ExitThread, GC_uintptr_t, GC_beginthreadex, GC_endthreadex): Also declare (and redirect) for GC_PTHREADS during GC build or if the client includes windows.h before gc.h file; add a comment. * win32_threads.c (thread_args, GC_win32_start_inner, GC_win32_start, GC_CreateThread, GC_ExitThread, GC_beginthreadex, GC_endthreadex): Also define for GC_PTHREADS. --- include/gc.h | 5 ++++- win32_threads.c | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/gc.h b/include/gc.h index b2727a6a..f67e4eaa 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1277,7 +1277,10 @@ typedef int (GC_CALLBACK * GC_has_static_roots_func)( GC_API void GC_CALL GC_register_has_static_roots_callback( GC_has_static_roots_func); -#if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) +#if defined(GC_WIN32_THREADS) \ + && (!defined(GC_PTHREADS) || defined(GC_BUILD) || defined(WINAPI)) + /* Note: for Cygwin and win32-pthread, this is skipped */ + /* unless windows.h is included before gc.h. */ # ifndef GC_NO_THREAD_DECLS diff --git a/win32_threads.c b/win32_threads.c index 8a401bc2..c9d4c0f2 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -2000,8 +2000,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, #endif /* PARALLEL_MARK */ -#ifndef GC_PTHREADS - /* We have no DllMain to take care of new threads. Thus we */ /* must properly intercept thread creation. */ @@ -2155,8 +2153,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # endif /* !MSWINCE */ -#endif /* !GC_PTHREADS */ - #ifdef GC_WINMAIN_REDIRECT /* This might be useful on WinCE. Shouldn't be used with GC_DLL. */ -- 2.40.0