[Gc] Is GC_init callable multiple times?

Alex xtzgzorex at gmail.com
Fri Mar 2 23:24:25 PST 2012

Hi Ivan,

OK, sounds good; in my case, it's easy to ensure that calls to
GC_init() are synchronized, so that shouldn't be problematic.



On Sat, Mar 3, 2012 at 8:22 AM, Ivan Maidanski <ivmai at mail.ru> wrote:
> Hi Alex,
> Calling GC_init second time (from the same thread) is just a no-op (although, this is not documented). (But concurrent GC_init calls from 2 threads might not work correctly.)
> Regards.
> 02 03 2012, 00:05 Alex <xtzgzorex at gmail.com>:
>> Hi,
>> Is the GC_init() function callable multiple times? In my case, I'm
>> wrapping libgc in a class in an OO language, so it is easiest to
>> simply call GC_init() in the constructor for said class. This means
>> that it may well be called multiple times, however. Looking at the
>> GC_init() and GC_init_inner() implementations in misc.c suggests that
>> at least some sanity checks are done to ensure double-initialization
>> doesn't happen even if GC_init() is called multiple times. However,
>> this behavior doesn't seem to be documented anywhere, so I'm unsure
>> whether calling GC_init() multiple times is considered sane and is
>> part of the interface?
>> Thanks in advance,
>> Alex
>> _______________________________________________
>> Gc mailing list
>> Gc at linux.hpl.hp.com
>> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list