[Gc] Using GC_CreateThread with CYGWIN builds

Thong (Tum) Nguyen tum at veridicus.com
Thu May 27 17:16:53 PDT 2004

Here's an updated patch that doesn't require dynamic memory allocation.

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com [mailto:gc-bounces at napali.hpl.hp.com]
> On Behalf Of Thong (Tum) Nguyen
> Sent: Thursday, 27 May 2004 9:38 a.m.
> To: 'Boehm, Hans'; gc at napali.hpl.hp.com; 'DotGnu-Develop'
> Subject: [Gc] Using GC_CreateThread with CYGWIN builds
> Hi,
> 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
> pthread_create.
> 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,
> ^Tum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tum_cygwin_creatthread.patch
Type: application/octet-stream
Size: 6553 bytes
Desc: not available
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20040528/b5947f20/tum_cygwin_creatthread.obj

More information about the Gc mailing list