diff options
-rw-r--r-- | thread.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -335,7 +335,7 @@ unblock_function_clear(rb_thread_t *th) } static void -threadptr_interrupt_locked(rb_thread_t *th, bool trap) { // th->interrupt_lock should be acquired here @@ -357,26 +357,27 @@ threadptr_interrupt_locked(rb_thread_t *th, bool trap) } static void -threadptr_interrupt(rb_thread_t *th, int trap) { rb_native_mutex_lock(&th->interrupt_lock); { - threadptr_interrupt_locked(th, trap); } rb_native_mutex_unlock(&th->interrupt_lock); } void rb_threadptr_interrupt(rb_thread_t *th) { RUBY_DEBUG_LOG("th:%u", rb_th_serial(th)); - threadptr_interrupt(th, false); } static void threadptr_trap_interrupt(rb_thread_t *th) { - threadptr_interrupt(th, true); } static void @@ -525,6 +526,9 @@ thread_cleanup_func(void *th_ptr, int atfork) } rb_native_mutex_destroy(&th->interrupt_lock); } static VALUE rb_threadptr_raise(rb_thread_t *, int, VALUE *); @@ -2423,6 +2427,7 @@ NORETURN(static void rb_threadptr_to_kill(rb_thread_t *th)); static void rb_threadptr_to_kill(rb_thread_t *th) { rb_threadptr_pending_interrupt_clear(th); th->status = THREAD_RUNNABLE; th->to_kill = 1; @@ -2446,6 +2451,11 @@ threadptr_get_interrupts(rb_thread_t *th) static void threadptr_interrupt_exec_exec(rb_thread_t *th); int rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing) { @@ -2453,6 +2463,8 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing) int postponed_job_interrupt = 0; int ret = FALSE; if (th->ec->raised_flag) return ret; while ((interrupt = threadptr_get_interrupts(th)) != 0) { @@ -6033,7 +6045,7 @@ rb_threadptr_interrupt_exec(rb_thread_t *th, rb_interrupt_exec_func_t *func, voi rb_native_mutex_lock(&th->interrupt_lock); { ccan_list_add_tail(&th->interrupt_exec_tasks, &task->node); - threadptr_interrupt_locked(th, true); } rb_native_mutex_unlock(&th->interrupt_lock); } |