From 04879212fb2e3418c1c4dc2f3bc4211476ea0560 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 31 Jan 2014 20:01:06 +0400 Subject: [PATCH] Improve documentation for disappearing links in gc.h * include/gc.h (GC_free): Add comment about disappearing links. * include/gc.h (GC_general_register_disappearing_link): Add comment about the conditions for a link to disappear. --- include/gc.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/gc.h b/include/gc.h index 9af396eb..3a940cde 100644 --- a/include/gc.h +++ b/include/gc.h @@ -429,7 +429,8 @@ GC_API int GC_CALL GC_posix_memalign(void ** /* memptr */, size_t /* align */, /* Explicitly deallocate an object. Dangerous if used incorrectly. */ /* Requires a pointer to the base of an object. */ /* If the argument is stubborn, it should not be changeable when freed. */ -/* An object should not be enabled for finalization when it is */ +/* An object should not be enabled for finalization (and it should not */ +/* contain registered disappearing links of any kind) when it is */ /* explicitly deallocated. */ /* GC_free(0) is a no-op, as required by ANSI C for free. */ GC_API void GC_CALL GC_free(void *); @@ -1062,7 +1063,10 @@ GC_API int GC_CALL GC_general_register_disappearing_link(void ** /* link */, /* email discussion with John Ellis. */ /* link must be non-NULL (and be properly aligned). */ /* obj must be a pointer to the first word of an object */ - /* allocated by GC_malloc or friends. It is unsafe to */ + /* allocated by GC_malloc or friends. A link */ + /* disappears when it is unregistered manually, or when */ + /* (*link) is cleared, or when the object containing */ + /* this link is garbage collected. It is unsafe to */ /* explicitly deallocate the object containing link. */ /* Explicit deallocation of obj may or may not cause */ /* link to eventually be cleared. */ -- 2.40.0