(guile.info.gz) Guardians
Info Catalog
(guile.info.gz) Weak References
(guile.info.gz) Memory Management
29.3 Guardians
==============
-- Scheme Procedure: make-guardian [greedy?]
-- C Function: scm_make_guardian (greedy_p)
Create a new guardian. A guardian protects a set of objects from
garbage collection, allowing a program to apply cleanup or other
actions.
`make-guardian' returns a procedure representing the guardian.
Calling the guardian procedure with an argument adds the argument
to the guardian's set of protected objects. Calling the guardian
procedure without an argument returns one of the protected objects
which are ready for garbage collection, or `#f' if no such object
is available. Objects which are returned in this way are removed
from the guardian.
`make-guardian' takes one optional argument that says whether the
new guardian should be greedy or sharing. If there is any chance
that any object protected by the guardian may be resurrected, then
you should make the guardian greedy (this is the default).
See R. Kent Dybvig, Carl Bruggeman, and David Eby (1993)
"Guardians in a Generation-Based Garbage Collector". ACM SIGPLAN
Conference on Programming Language Design and Implementation, June
1993.
(the semantics are slightly different at this point, but the paper
still (mostly) accurately describes the interface).
-- Scheme Procedure: destroy-guardian! guardian
-- C Function: scm_destroy_guardian_x (guardian)
Destroys GUARDIAN, by making it impossible to put any more objects
in it or get any objects from it. It also unguards any objects
guarded by GUARDIAN.
-- Scheme Procedure: guardian-greedy? guardian
-- C Function: scm_guardian_greedy_p (guardian)
Return `#t' if GUARDIAN is a greedy guardian, otherwise `#f'.
-- Scheme Procedure: guardian-destroyed? guardian
-- C Function: scm_guardian_destroyed_p (guardian)
Return `#t' if GUARDIAN has been destroyed, otherwise `#f'.
Info Catalog
(guile.info.gz) Weak References
(guile.info.gz) Memory Management
automatically generated byinfo2html