ruby-changes:62920
From: Samuel <ko1@a...>
Date: Mon, 14 Sep 2020 13:44:32 +0900 (JST)
Subject: [ruby-changes:62920] 703e529751 (master): Add `rb_thread_current_scheduler()`.
https://git.ruby-lang.org/ruby.git/commit/?id=703e529751 From 703e529751deb086a46a9c029ce38d4fff14e84c Mon Sep 17 00:00:00 2001 From: Samuel Williams <samuel.williams@o...> Date: Thu, 20 Aug 2020 13:47:55 +1200 Subject: Add `rb_thread_current_scheduler()`. diff --git a/internal/thread.h b/internal/thread.h index 91626b7..e7a9019 100644 --- a/internal/thread.h +++ b/internal/thread.h @@ -37,9 +37,11 @@ void rb_mutex_allow_trap(VALUE self, int val); https://github.com/ruby/ruby/blob/trunk/internal/thread.h#L37 VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data); VALUE rb_mutex_owned_p(VALUE self); -VALUE rb_thread_scheduler_get(VALUE); -VALUE rb_thread_scheduler_set(VALUE, VALUE); +VALUE rb_thread_scheduler_get(VALUE thread); +VALUE rb_thread_scheduler_set(VALUE thread, VALUE scheduler); + VALUE rb_thread_scheduler_if_nonblocking(VALUE thread); +VALUE rb_thread_current_scheduler(); RUBY_SYMBOL_EXPORT_BEGIN /* Temporary. This API will be removed (renamed). */ diff --git a/thread.c b/thread.c index 2f265c5..d10d411 100644 --- a/thread.c +++ b/thread.c @@ -3749,6 +3749,12 @@ rb_thread_scheduler(VALUE klass) https://github.com/ruby/ruby/blob/trunk/thread.c#L3749 return rb_thread_scheduler_if_nonblocking(rb_thread_current()); } +static VALUE +rb_thread_current_scheduler() +{ + return rb_thread_scheduler_if_nonblocking(rb_thread_current()); +} + VALUE rb_thread_scheduler_if_nonblocking(VALUE thread) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/