summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-02-09 19:39:56 +1300
committerGitHub <noreply@github.com>2021-02-09 19:39:56 +1300
commit5f69a7f60467fa58c2f998daffab43e118bff36c (patch)
treef60e3a5add29eb9cc7e68433c4e373e2a2facab7 /cont.c
parent3c593f28ede99b77d4fe3258f9bda78dcee238a3 (diff)
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`. * Use public interface if available. * Use `rb_check_funcall` where possible. * Don't use `unblock` unless the fiber was non-blocking.
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cont.c b/cont.c
index 694c2d9632..abd6a2f46a 100644
--- a/cont.c
+++ b/cont.c
@@ -24,7 +24,7 @@
#include "internal/cont.h"
#include "internal/proc.h"
#include "internal/warnings.h"
-#include "internal/scheduler.h"
+#include "ruby/fiber/scheduler.h"
#include "mjit.h"
#include "vm_core.h"
#include "id_table.h"
@@ -1156,6 +1156,11 @@ VALUE rb_fiberptr_self(struct rb_fiber_struct *fiber)
return fiber->cont.self;
}
+unsigned int rb_fiberptr_blocking(struct rb_fiber_struct *fiber)
+{
+ return fiber->blocking;
+}
+
// This is used for root_fiber because other fibers call cont_init_mjit_cont through cont_new.
void
rb_fiber_init_mjit_cont(struct rb_fiber_struct *fiber)
@@ -1975,7 +1980,7 @@ rb_f_fiber(int argc, VALUE *argv, VALUE obj)
static VALUE
rb_fiber_scheduler(VALUE klass)
{
- return rb_scheduler_get();
+ return rb_fiber_scheduler_get();
}
/*
@@ -1997,11 +2002,7 @@ rb_fiber_scheduler(VALUE klass)
static VALUE
rb_fiber_set_scheduler(VALUE klass, VALUE scheduler)
{
- // if (rb_scheduler_get() != Qnil) {
- // rb_raise(rb_eFiberError, "Scheduler is already defined!");
- // }
-
- return rb_scheduler_set(scheduler);
+ return rb_fiber_scheduler_set(scheduler);
}
static void rb_fiber_terminate(rb_fiber_t *fiber, int need_interrupt);