diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-12-13 11:52:19 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-12-18 11:12:34 +0900 |
commit | 57f6329ba7aa744101efe026bea0a0bd46c77fc8 (patch) | |
tree | dfc3f2abff26496b2525c059f3bfde3d2529cfe1 /thread.c | |
parent | c07fb791504cdfa32ff1be165758fcc624b26c2d (diff) |
Check RUBY_THREAD_TIMESLICE value
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12328
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -5511,7 +5511,13 @@ Init_Thread(void) const char * ptr = getenv("RUBY_THREAD_TIMESLICE"); if (ptr) { - thread_default_quantum_ms = (uint32_t)strtol(ptr, NULL, 0); + long quantum = strtol(ptr, NULL, 0); + if (quantum > 0 && quantum <= UINT32_MAX) { + thread_default_quantum_ms = (uint32_t)quantum; + } + else if (0) { + fprintf(stderr, "Ignored RUBY_THREAD_TIMESLICE=%s\n", ptr); + } } { |