[Gc] In bdwgc, do finalizers need to be strictly async-signal
hans.boehm at hp.com
Fri Dec 30 22:02:48 PST 2011
They don't need to be fully async-signal-safe. The details depend on how finalizers are invoked. If GC_finalize_on_demand is not set (the default, but not recommended for anything but very simple uses) finalizers will be invoked on the way out of an allocation call. The finalizer must thus be callable in any context in which GC_malloc etc. can be called.
If GC_finalize_on_demand is set, and GC_invoke_finalizers is explicitly called, then finalizers are invoked only from GC_invoke_finalizers. Typically this will be done from a thread dedicated to that purpose. In that case it's fine to acquire locks, etc., from finalizers.
> -----Original Message-----
> From: gc-bounces at linux.hpl.hp.com [mailto:gc-bounces at linux.hpl.hp.com]
> On Behalf Of Jean-Claude Beaudoin
> Sent: Friday, December 30, 2011 5:00 PM
> To: gc at linux.hpl.hp.com
> Subject: [Gc] In bdwgc, do finalizers need to be strictly async-signal
> Objviously my question takes its full meaning in a POSIX context
> (like Linux) but I think it still is somewhat relevant to other
> non-POSIX situations (like MS-Windows).
> Sorry if the question is too naive or is a FAQ of some sort
> but I could not find a clear and direct answer in the documentation
> at hand.
> Jean-Claude Beaudoin
> Gc mailing list
> Gc at linux.hpl.hp.com
More information about the Gc