![[index]](../icons/index.gif)
Next: Garbage Collection
Up: Memory Management
Previous: Weak Boxes
A will executor manages a collection of values and
associated will procedures. The will procedure for each
value is invoked when the value has been proven unreachable --
except through will executors, weak boxes, and custodians -- by the
automatic memory manager.
Calling the will-execute or will-try-execute procedure
executes a will that is ready in the specified will executor.
- (make-will-executor) returns a new will executor with no
managed values.
- (will-executor? v) returns #t if v is a will
executor, #f otherwise.
- (will-register executor v proc) registers the value v
with the will procedure proc in the will executor
executor. When v is proven unreachable, then the
procedure proc may be called with v as its argument via
will-execute or will-try-execute.
- (will-execute executor) invokes the will procedure for a
single ``unreachable'' value registered with the executor
executable. The value(s) returned by the will procedure is the
result of the will-execute call. If no will is ready for
immediate execution, will-execute blocks until one is ready.
- (will-try-execute executor) is like will-execute if a
will is ready for immediate execution. Otherwise, #f is
returned.
If a value is registered with multiple wills, the wills are executed
in the reverse order of registration. Since executing a will
procedure makes the value reachable again, the value must be proven
unreachable once again before another of the wills is executed.
If the content value of a weak box is registered with a will executor,
the weak box's content is not changed to #f until all wills
have been executed for the value and the value has been proven
unreachable again.
PLT