Skip to content

Commit 42b7455

Browse files
committed
WIP
1 parent d6d63b2 commit 42b7455

3 files changed

Lines changed: 508 additions & 0 deletions

File tree

cont.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,7 @@ fiber_check_killed(rb_fiber_t *fiber)
26562656
static inline VALUE
26572657
fiber_switch(rb_fiber_t *fiber, int argc, const VALUE *argv, int kw_splat, rb_fiber_t *resuming_fiber, bool yielding)
26582658
{
2659+
fprintf(stderr, "fiber_switch\n");
26592660
VALUE value;
26602661
rb_context_t *cont = &fiber->cont;
26612662
rb_thread_t *th = GET_THREAD();

ractor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "ruby/ruby.h"
44
#include "ruby/thread.h"
55
#include "ruby/ractor.h"
6+
#include "ruby/fiber/scheduler.h"
67
#include "ruby/thread_native.h"
78
#include "vm_core.h"
89
#include "eval_intern.h"
@@ -1236,6 +1237,11 @@ ractor_take(rb_execution_context_t *ec, rb_ractor_t *r)
12361237
.sender = 0,
12371238
};
12381239

1240+
VALUE scheduler = rb_fiber_scheduler_current();
1241+
if (!NIL_P(scheduler)) {
1242+
rb_fiber_scheduler_block(scheduler, r->pub.self, Qnil);
1243+
}
1244+
12391245
ractor_register_take(cr, r, &take_basket, true, NULL, false);
12401246

12411247
while (UNDEF_P(v = ractor_try_take(cr, r, &take_basket))) {

0 commit comments

Comments
 (0)