diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-11-11 14:37:31 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-11-11 15:49:02 +0900 |
commit | 1e8abe5d03ae386af82e2c95ef05170cd9791889 (patch) | |
tree | 053d9153f20d975961d39cc6e2471290a49bd618 /thread.c | |
parent | dd07354f2797473261f06159801e50dc6445ef76 (diff) |
introduce USE_VM_CLOCK for windows.
The timer function used on windows system set timer interrupt
flag of current main ractor's executing ec and thread can detect
the end of time slice. However, to set all ec->interrupt_flag for
all running ractors, it is requires to synchronize with other ractors.
However, timer thread can not acquire the ractor-wide lock because
of some limitation.
To solve this issue, this patch introduces USE_VM_CLOCK compile option
to introduce rb_vm_t::clock. This clock will be incremented by the
timer thread and each thread can check the incrementing by comparison
with previous checked clock. At last, on windows platform this patch
introduces some overhead, but I think there is no critical performance
issue because of this modification.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3754
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 10 |
1 files changed, 0 insertions, 10 deletions
@@ -341,7 +341,6 @@ rb_thread_s_debug_set(VALUE self, VALUE val) #endif NOINLINE(static int thread_start_func_2(rb_thread_t *th, VALUE *stack_start)); -static void timer_thread_function(rb_execution_context_t *ec); void ruby_sigchld_handler(rb_vm_t *); /* signal.c */ static void @@ -4575,15 +4574,6 @@ rb_threadptr_check_signal(rb_thread_t *mth) } static void -timer_thread_function(rb_execution_context_t *ec) -{ - // strictly speaking, accessing gvl->owner is not thread-safe - if (ec) { - RUBY_VM_SET_TIMER_INTERRUPT(ec); - } -} - -static void async_bug_fd(const char *mesg, int errno_arg, int fd) { char buff[64]; |