summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-27 12:27:13 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-27 12:27:13 +0000
commit4af243a8afa0dfefc74bb68dd08d9c5ff3ccc5d5 (patch)
tree00cb19ec62034715709fcf5d8856fc417e4badd8 /thread.c
parent6fd326e76cba5fecda1470c808c6d8cc61d60381 (diff)
* eval.c (ruby_cleanup): before cleanup, check signal buffer and run
handler if any. [ruby-core:20970] * thread.c (rb_threadptr_check_signal): separeted from timer_thread_function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index 094427f06c..ad35c103e7 100644
--- a/thread.c
+++ b/thread.c
@@ -290,7 +290,7 @@ reset_unblock_function(rb_thread_t *th, const struct rb_unblock_callback *old)
native_mutex_unlock(&th->interrupt_lock);
}
-static void
+void
rb_threadptr_interrupt(rb_thread_t *th)
{
native_mutex_lock(&th->interrupt_lock);
@@ -2651,18 +2651,13 @@ rb_gc_save_machine_context(rb_thread_t *th)
int rb_get_next_signal(void);
-static void
-timer_thread_function(void *arg)
+void
+rb_threadptr_check_signal(rb_thread_t *mth)
{
- rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */
int sig;
- rb_thread_t *mth;
- /* for time slice */
- RUBY_VM_SET_TIMER_INTERRUPT(vm->running_thread);
+ /* mth must be main_thread */
- /* check signal */
- mth = vm->main_thread;
if (!mth->exec_signal && (sig = rb_get_next_signal()) > 0) {
enum rb_thread_status prev_status = mth->status;
thread_debug("main_thread: %s, sig: %d\n",
@@ -2672,6 +2667,19 @@ timer_thread_function(void *arg)
rb_threadptr_interrupt(mth);
mth->status = prev_status;
}
+}
+
+static void
+timer_thread_function(void *arg)
+{
+ rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */
+ rb_thread_t *mth;
+
+ /* for time slice */
+ RUBY_VM_SET_TIMER_INTERRUPT(vm->running_thread);
+
+ /* check signal */
+ rb_threadptr_check_signal(vm->main_thread);
#if 0
/* prove profiler */