diff options
| author | Luke Gruber <luke.gruber@shopify.com> | 2025-12-12 14:47:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-12 14:47:43 -0500 |
| commit | 3add3db797c4216423fdaa4bef6e2ee3c7630303 (patch) | |
| tree | 449d300354e1aa957c0922cc1be9c6f25310d5ce /include/ruby/fiber | |
| parent | 5903ed7ba9ca60546aa0dd97e92b3d381b7918d3 (diff) | |
Fewer calls to `GET_EC()` and `GET_THREAD()` (#15506)
The changes are to `io.c` and `thread.c`.
I changed the API of 2 exported thread functions from `internal/thread.h` that
didn't look like they had any use in C extensions:
* rb_thread_wait_for_single_fd
* rb_thread_io_wait
I didn't change the following exported internal function because it's
used in C extensions:
* rb_thread_fd_select
I added a comment to note that this function, although internal, is used
in C extensions.
Diffstat (limited to 'include/ruby/fiber')
| -rw-r--r-- | include/ruby/fiber/scheduler.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/ruby/fiber/scheduler.h b/include/ruby/fiber/scheduler.h index 537a3a7bb2..4d764f68ae 100644 --- a/include/ruby/fiber/scheduler.h +++ b/include/ruby/fiber/scheduler.h @@ -27,6 +27,7 @@ RBIMPL_SYMBOL_EXPORT_BEGIN() #define RUBY_FIBER_SCHEDULER_VERSION 3 struct timeval; +struct rb_thread_struct; /** * Wrap a `ssize_t` and `int errno` into a single `VALUE`. This interface should @@ -118,7 +119,7 @@ VALUE rb_fiber_scheduler_current(void); /** * Identical to rb_fiber_scheduler_current(), except it queries for that of the - * passed thread instead of the implicit current one. + * passed thread value instead of the implicit current one. * * @param[in] thread Target thread. * @exception rb_eTypeError `thread` is not a thread. @@ -128,6 +129,17 @@ VALUE rb_fiber_scheduler_current(void); VALUE rb_fiber_scheduler_current_for_thread(VALUE thread); /** + * Identical to rb_fiber_scheduler_current_for_thread(), except it expects + * a threadptr instead of a thread value. + * + * @param[in] thread Target thread. + * @exception rb_eTypeError `thread` is not a thread. + * @retval RUBY_Qnil No scheduler is in effect in `thread`. + * @retval otherwise The scheduler that is in effect in `thread`. + */ +VALUE rb_fiber_scheduler_current_for_threadptr(struct rb_thread_struct *thread); + +/** * Converts the passed timeout to an expression that rb_fiber_scheduler_block() * etc. expects. * |
