diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 02:51:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 02:51:05 +0000 |
commit | 4ded52b623ebd1b3de12db82f8b54cc156c1fd28 (patch) | |
tree | 7b44f5fa6aa0e5c49b2928d43f00ccc71c97a07f /gc.c | |
parent | 43db576e61cc70fc7d8280183b71985e5ab18651 (diff) | |
download | ruby-4ded52b623ebd1b3de12db82f8b54cc156c1fd28.tar.gz |
* file.c (rb_get_path): get path string via "to_path" method if
path object is not a string. [Ruby2]
* gc.c (rb_gc_call_finalizer_at_exit): do not free threads in the
exit finalizers.
* io.c (rb_io_reopen): should use rb_io_check_io().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -45,7 +45,7 @@ extern unsigned long __libc_ia64_register_backing_store_base; #endif void re_free_registers _((struct re_registers*)); -void rb_io_fptr_finalize _((struct OpenFile*)); +int rb_io_fptr_finalize _((struct OpenFile*)); #if !defined(setjmp) && defined(HAVE__SETJMP) #define setjmp(env) _setjmp(env) @@ -1786,11 +1786,12 @@ rb_gc_call_finalizer_at_exit() } } /* run data object's finalizers */ - for (i = 0; i < heaps_used; i++) { + for (i = heaps_used-1; 0 <= i; i--) { p = heaps[i].slot; pend = p + heaps[i].limit; while (p < pend) { if (BUILTIN_TYPE(p) == T_DATA && - DATA_PTR(p) && RANY(p)->as.data.dfree) { + DATA_PTR(p) && RANY(p)->as.data.dfree && + RANY(p)->as.basic.klass != rb_cThread) { p->as.free.flags = 0; if ((long)RANY(p)->as.data.dfree == -1) { RUBY_CRITICAL(free(DATA_PTR(p))); @@ -1800,8 +1801,9 @@ rb_gc_call_finalizer_at_exit() } } else if (BUILTIN_TYPE(p) == T_FILE) { - p->as.free.flags = 0; - rb_io_fptr_finalize(RANY(p)->as.file.fptr); + if (rb_io_fptr_finalize(RANY(p)->as.file.fptr)) { + p->as.free.flags = 0; + } } p++; } |