aboutsummaryrefslogtreecommitdiffstats
path: root/thread_win32.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-11-11 14:37:31 +0900
committerKoichi Sasada <ko1@atdot.net>2020-11-11 15:49:02 +0900
commit1e8abe5d03ae386af82e2c95ef05170cd9791889 (patch)
tree053d9153f20d975961d39cc6e2471290a49bd618 /thread_win32.h
parentdd07354f2797473261f06159801e50dc6445ef76 (diff)
downloadruby-1e8abe5d03ae386af82e2c95ef05170cd9791889.tar.gz
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.
Diffstat (limited to 'thread_win32.h')
-rw-r--r--thread_win32.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/thread_win32.h b/thread_win32.h
index cdcc159b2d..bc8eea7801 100644
--- a/thread_win32.h
+++ b/thread_win32.h
@@ -16,6 +16,8 @@
# undef _WIN32
# endif
+#define USE_VM_CLOCK 1
+
WINBASEAPI BOOL WINAPI
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);