mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Introduce Fiber Scheduler blocking_region
hook. (#11963)
This commit is contained in:
parent
550ac2f2ed
commit
87fb44dff6
Notes:
git
2024-10-31 04:26:56 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
9 changed files with 118 additions and 12 deletions
12
thread.c
12
thread.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue