[Gc] Calling ‘GC_pthread_create’ from a pthread key destructor

Ludovic Courtès ludo at gnu.org
Sun Apr 24 06:04:55 PDT 2011


Hi,

Ivan Maidanski <ivmai at mail.ru> writes:

>> pthread_setspecific (key, GC_STRDUP ("hello, world"));
>
> Just one note. Are you aware that this code is equivalent (since TLS is not traced by GC) to:
>
> (void)GC_STRDUP ("hello, world");
> pthread_setspecific (key, <some_number>);

Yes.  The only point of this statement is to stress the GC and associate
an initial value with the key (otherwise its destructor is never
called.)

Thanks,
Ludo’.



More information about the Gc mailing list