[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Using GC_CreateThread with CYGWIN builds

From: Thong (Tum) Nguyen
Subject: [DotGNU]Using GC_CreateThread with CYGWIN builds
Date: Thu, 27 May 2004 09:38:16 +1200


I'm one of the DOTGNU/pnet developers and I've been working on threading/gc
support.  We use CreateThread when building on Windows regardless of whether
we're using a CYGWIN or MINGW32 build.  Currently, libgc doesn't wrap
CreateThread when using a CYGWIN.  I tried enabling the standard windows
GC_CreateThread wrappers for CYGWIN but that appeared to be very unstable.
The solution I eventually used (which is stable) is to write a
GC_CreateThread implementation for CYGWIN builds that calls CYGWIN's
pthread_create (mapping windows CreateThread semantics to pthread_create
semantics).  CYGWIN's pthread_create will of course eventually call the real
windows CreateThread API.  I think a possible reason why simply using the
GC_CreateThread wrapper for normal builds crashes when using CYGWIN is
because the CYGWIN runtime libraries expect threads to be created using

In additional to the GC_CreateThread implementation for CYGWIN builds, I've
had to change some GC_malloc_uncollectable/GC_free calls to malloc/free
because calling the GC allocator while creating a new thread appears be a
source of deadlocks between the GC and CRT.

The patch is for v6.3alpha6 and is attached.

All the best,


Attachment: tum_cygwin_creatthread.patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]