July 17th Friday (七月 十七日 金曜日)
2009-07-16 16:17
357 查看
Wills and Executors
A will executor manages a collection of values and associated will procedures (a.k.a. finalizers). The will procedure for each
value is ready to be executed when the value has been proven (by the garbage collector) to be unreachable, except through weak
references or as the registrant for other will executors. A will is useful for triggering clean-up actions on data associated with
an unreachable value, such as closing a port embedded in an object when the object is no longer used.
Calling the will-execute or will-try-execute procedure executes a will that is ready in the specified will executor. Wills are
not executed automatically, because certain programs need control to avoid race conditions. However, a program can create a thread
whose sole job is to execute wills for a particular executor.
If a value is registered with multiple wills (in one or multiple executors), the wills are readied in the reverse order of registration.
Since readying a will procedure makes the value reachable again, the will must be executed and the value must be proven again unreachable
through only weak references before another of the wills is readied or executed. However, wills for distinct unreachable values are
readied at the same time, regardless of whether the values are reachable from each other.
A will executor's register is held non-weakly until after the corresponding will procedure is executed. Thus, 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 again reachable through only weak references.
A will executor manages a collection of values and associated will procedures (a.k.a. finalizers). The will procedure for each
value is ready to be executed when the value has been proven (by the garbage collector) to be unreachable, except through weak
references or as the registrant for other will executors. A will is useful for triggering clean-up actions on data associated with
an unreachable value, such as closing a port embedded in an object when the object is no longer used.
Calling the will-execute or will-try-execute procedure executes a will that is ready in the specified will executor. Wills are
not executed automatically, because certain programs need control to avoid race conditions. However, a program can create a thread
whose sole job is to execute wills for a particular executor.
If a value is registered with multiple wills (in one or multiple executors), the wills are readied in the reverse order of registration.
Since readying a will procedure makes the value reachable again, the will must be executed and the value must be proven again unreachable
through only weak references before another of the wills is readied or executed. However, wills for distinct unreachable values are
readied at the same time, regardless of whether the values are reachable from each other.
A will executor's register is held non-weakly until after the corresponding will procedure is executed. Thus, 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 again reachable through only weak references.
相关文章推荐
- 2008 July 4th Friday (七月 四日 金曜日)
- April 17th Friday (四月 十七日 金曜日)
- July 6th Friday (七月 六日 金曜日)
- 2008 July 17th Thursday (七月 十七日 木曜日)
- July 10th Friday (七月 十日 金曜日)
- 2008 July 18th Friday (七月 十八日 金曜日)
- 2008 October 17th Friday (十月 十七日 金曜日)
- July 3th Friday (七月 三日 金曜日)
- July 24th Friday (七月 二十四日 金曜日)
- 2008 July 11th Friday (七月 十一日 金曜日)
- July 13th Friday (七月 十三日 金曜日)
- 2008 July 25th Friday (七月 二十五日 金曜日)
- July 31th Friday (七月 三十一日 金曜日)
- July 27th Friday (七月 二十七日 金曜日)
- July 17th Monday (七月 十七日 火曜日)
- August 17th Friday (八月 十五日 金曜日)
- July 31th Tuesday (七月 三十一日 火曜日)
- October 19th Friday (十月 十九日 金曜日)
- 2008 January 17th Thursday (一月 十七日 木曜日)
- 2008 March 17th Monday (三月 十七日 月曜日)