diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-27 05:59:32 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-27 05:59:32 +0000 |
commit | 60be3dc560d1bd61344c328ee6a939ec9cffa537 (patch) | |
tree | 5b3e6083f50f309db656bcd26f8697aaecd826a3 /thread.c | |
parent | c30616378e04578a3bfe8650b3c98caf7968b458 (diff) | |
download | ruby-60be3dc560d1bd61344c328ee6a939ec9cffa537.tar.gz |
* include/ruby/ruby.h: add a type T_DEFERRED.
* gc.c: fix deferred finalizer system. finalize processes of
T_DATA and T_FILE are executed after gc process.
And fix to use BUILTIN_TYPE() instead of seeing flag.
* thread.c, vm_core.h: add RUBY_VM_SET_FINALIZER_INTERRUPT()
and check intterupt_flag at rb_thread_execute_interrupts().
* thread.c (mutex_mark): fix to mark next_mutex.
* vm.c (rb_thread_mark): fix to mark keeping_mutexes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -935,8 +935,12 @@ void rb_thread_execute_interrupts(rb_thread_t *th) { if (th->raised_flag) return; + while (th->interrupt_flag) { enum rb_thread_status status = th->status; + int timer_interrupt = th->interrupt_flag & 0x01; + int finalizer_interrupt = th->interrupt_flag & 0x04; + th->status = THREAD_RUNNABLE; th->interrupt_flag = 0; @@ -963,10 +967,15 @@ rb_thread_execute_interrupts(rb_thread_t *th) } th->status = status; - /* thread pass */ - rb_thread_schedule(); + if (finalizer_interrupt) { + rb_gc_finalize_deferred(); + } + + if (timer_interrupt) { + EXEC_EVENT_HOOK(th, RUBY_EVENT_SWITCH, th->cfp->self, 0, 0); + rb_thread_schedule(); + } } - EXEC_EVENT_HOOK(th, RUBY_EVENT_SWITCH, th->cfp->self, 0, 0); } @@ -2494,6 +2503,7 @@ mutex_mark(void *ptr) { if (ptr) { mutex_t *mutex = ptr; + rb_gc_mark(mutex->next_mutex); if (mutex->th) { rb_gc_mark(mutex->th->self); } |