diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-01-08 19:07:16 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-01-09 22:38:06 +0900 |
commit | 590dc06e3840cc7b00d80ccaac9fbf42573428f8 (patch) | |
tree | e5f6aa316246401b8d89e7419ddf0976238c04b5 /ext/-test-/gvl/call_without_gvl/call_without_gvl.c | |
parent | 161a20df28dd09ff35a32a7e2b7ce6cab7079707 (diff) |
Get rid of defining methods for tests in core classes
Not to interfere in other tests.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4043
Diffstat (limited to 'ext/-test-/gvl/call_without_gvl/call_without_gvl.c')
-rw-r--r-- | ext/-test-/gvl/call_without_gvl/call_without_gvl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/-test-/gvl/call_without_gvl/call_without_gvl.c b/ext/-test-/gvl/call_without_gvl/call_without_gvl.c index d77c2f323e..233635421b 100644 --- a/ext/-test-/gvl/call_without_gvl/call_without_gvl.c +++ b/ext/-test-/gvl/call_without_gvl/call_without_gvl.c @@ -24,7 +24,7 @@ thread_runnable_sleep(VALUE thread, VALUE timeout) rb_thread_call_without_gvl(native_sleep_callback, &timeval, RUBY_UBF_IO, NULL); - return thread; + return Qnil; } struct loop_ctl { @@ -65,12 +65,14 @@ thread_ubf_async_safe(VALUE thread, VALUE notify_fd) ctl.stop = 0; rb_nogvl(do_loop, &ctl, stop_set, &ctl, RB_NOGVL_UBF_ASYNC_SAFE); - return thread; + return Qnil; } void Init_call_without_gvl(void) { - rb_define_method(rb_cThread, "__runnable_sleep__", thread_runnable_sleep, 1); - rb_define_method(rb_cThread, "__ubf_async_safe__", thread_ubf_async_safe, 1); + VALUE mBug = rb_define_module("Bug"); + VALUE klass = rb_define_module_under(mBug, "Thread"); + rb_define_singleton_method(klass, "runnable_sleep", thread_runnable_sleep, 1); + rb_define_singleton_method(klass, "ubf_async_safe", thread_ubf_async_safe, 1); } |