[Gc] Exporting GC_set_mark_bit and GC_clear_mark_bit

Petter Urkedal urkedal at nbi.dk
Sat Jan 7 06:29:17 PST 2012


On 2012-01-07, Ivan Maidanski wrote:
> Hi Petter and Hans,
> 
> Hans -
> What do you think?
> 
> Petter -
> declspec for func definition should match func declaration i.e. if should add GC_API_PRIV for definitions.
> But: by current design, GC_API_PRIV is used for functions that should be private but used by some tests, so I think it's better, if it would be considered to make these functions public, to move the to some public header (e.g., gc_mark.h) and use GC_API declspec and GC_CALL calling conv modifier.

I see, I interpreted it as "public use at your own risk".  Moving it to
gc_mark.h sounds good.  It would be nice to stop including private
headers.  I can prepare a new patch, but:

  - Do we want to move "typedef int GC_bool" to "gc.h"?  Maybe also add
    GC_TRUE and GC_FALSE there (but leave TRUE and FALSE in gc_priv.h)?
    Or do we change the return type of GC_is_marked to "int"?

  - I'll add a comment that the client must hold the allocation lock.
    Maybe GC_is_marked is safe enough to call without, but I don't think
    the result is very useful without locking.

> 
> Regards
> 
> 07 января 2012, 15:37 от Petter Urkedal <urkedal at nbi.dk>:
> > May I ask that the GC_set_mark_bit and GC_clear_mark_bit are exported?
> > I use them as part of the code to resurrect objects in weak hash-tables.
> > Imitating GC_is_marked I think this should do:
> > https://github.com/paurkedal/bdwgc/commit/20652be420b7c38fab92ac2601b4210386df4a7e
> > 
> > Cheers,
> > Petter


More information about the Gc mailing list