path: root/thread.c
diff options
authorKoichi Sasada <>2020-11-11 14:37:31 +0900
committerKoichi Sasada <>2020-11-11 15:49:02 +0900
commit1e8abe5d03ae386af82e2c95ef05170cd9791889 (patch)
tree053d9153f20d975961d39cc6e2471290a49bd618 /thread.c
parentdd07354f2797473261f06159801e50dc6445ef76 (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: Merged:
Diffstat (limited to 'thread.c')
1 files changed, 0 insertions, 10 deletions
diff --git a/thread.c b/thread.c
index 77cc7e3..d0187ae 100644
--- a/thread.c
+++ b/thread.c
@@ -341,7 +341,6 @@ rb_thread_s_debug_set(VALUE self, VALUE val)
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) {
- }
-static void
async_bug_fd(const char *mesg, int errno_arg, int fd)
char buff[64];