mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (rb_gc_call_finalizer_at_exit): finalize deferred IO and Data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e5afadda03
commit
952385b712
2 changed files with 11 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
|||
Wed Oct 1 19:13:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Wed Oct 1 21:36:35 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (rb_gc_call_finalizer_at_exit): finalize deferred IO and Data.
|
||||
|
||||
* gc.c (rb_gc_call_finalizer_at_exit): deffers IO finalization.
|
||||
[ruby-dev:36646]
|
||||
|
|
10
gc.c
10
gc.c
|
@ -2357,13 +2357,13 @@ rb_gc_call_finalizer_at_exit(void)
|
|||
{
|
||||
rb_objspace_t *objspace = &rb_objspace;
|
||||
RVALUE *p, *pend;
|
||||
RVALUE *final_list = 0;
|
||||
size_t i;
|
||||
|
||||
/* run finalizers */
|
||||
if (finalizer_table) {
|
||||
finalize_deferred(objspace);
|
||||
while (finalizer_table->num_entries > 0) {
|
||||
RVALUE *final_list = 0;
|
||||
st_foreach(finalizer_table, chain_finalized_object,
|
||||
(st_data_t)&final_list);
|
||||
if (!(p = final_list)) break;
|
||||
|
@ -2390,18 +2390,24 @@ rb_gc_call_finalizer_at_exit(void)
|
|||
}
|
||||
else if (RANY(p)->as.data.dfree) {
|
||||
make_deferred(RANY(p));
|
||||
RANY(p)->as.free.next = final_list;
|
||||
final_list = p;
|
||||
}
|
||||
}
|
||||
else if (BUILTIN_TYPE(p) == T_FILE) {
|
||||
if (RANY(p)->as.file.fptr) {
|
||||
make_io_deferred(RANY(p));
|
||||
RANY(p)->as.free.next = final_list;
|
||||
final_list = p;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
during_gc = 0;
|
||||
finalize_deferred(objspace);
|
||||
if (final_list) {
|
||||
finalize_list(objspace, final_list);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue