Re: [Gc] GC v.7.1 DARWIN x86 usage of threads

Ivan Maidanski ivmai at mail.ru
Mon Aug 30 12:08:34 PDT 2010


Hi!

Mon, 30 Aug 2010 14:00:48 +0000 (GMT) Windev Windev <windev92 at yahoo.fr>:

> 
> 
> Hi all, 
> 
> I have GC_DARWIN_THREAD macro defined. 

To be portable, it's better to define GC_THREADS (at least starting at gc v7.2a4).

> What is the easiest way to create a thread and to register it to the threads
> list?

The easiest way is to use redefined/redirected OS specific primitives (for Win32 they are _beginthreadex and CreateThread, for others - pthread_create). All you need is to define GC_THREADS and include gc.h before use of that prototypes.

> 
> With GC_WIN32_THREADS, using GC_CreateThread does the trick (spawns thread and
> registers it via GC_win32_start).
> Is there an equivalent for this using GC_DARWIN_THREAD?

CreateThread is just a Win32-specific primitive, pthread_create is used in other OSes.

> 
> I have never used pthreads, so if there is a way to avoid it like on Win32, I
> would be very happy.

I don't know it - probably some custom portable wrapper lib (independent of GC).

> 
> thanks



More information about the Gc mailing list