diff options
| author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2024-10-31 17:26:37 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 17:26:37 +1300 |
| commit | 87fb44dff6409a19d12052cf0fc07ba80a4c45ac (patch) | |
| tree | 1446cd9390356ae660c50ef7ae877bc57af8d567 /thread.c | |
| parent | 550ac2f2edc07d1b63e3755233df0758a652b53f (diff) | |
Introduce Fiber Scheduler `blocking_region` hook. (#11963)
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'thread.c')
| -rw-r--r-- | thread.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1523,6 +1523,18 @@ rb_nogvl(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2, int flags) { + VALUE scheduler = rb_fiber_scheduler_current(); + if (scheduler != Qnil) { + struct rb_fiber_scheduler_blocking_region_state state; + + VALUE result = rb_fiber_scheduler_blocking_region(scheduler, func, data1, ubf, data2, flags, &state); + + if (!UNDEF_P(result)) { + rb_errno_set(state.saved_errno); + return state.result; + } + } + void *val = 0; rb_execution_context_t *ec = GET_EC(); rb_thread_t *th = rb_ec_thread_ptr(ec); |
