summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-04 10:36:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-13 23:20:02 +0900
commit521ad9a13aef1e1dae4eaff70d3e6b2e358aa095 (patch)
tree6060bd402d95c86fa2b807ca565e67ff5326da5b
parent0036648a420f945624898568bb82bc5f83195d12 (diff)
Moved Fiber methods into core [Feature #17407]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4060
-rw-r--r--cont.c16
-rw-r--r--ext/fiber/depend3
-rw-r--r--ext/fiber/extconf.rb4
-rw-r--r--ext/fiber/fiber.c8
4 files changed, 5 insertions, 26 deletions
diff --git a/cont.c b/cont.c
index cfd4eca5504..694c2d96327 100644
--- a/cont.c
+++ b/cont.c
@@ -3060,6 +3060,7 @@ Init_Cont(void)
rb_define_alloc_func(rb_cFiber, fiber_alloc);
rb_eFiberError = rb_define_class("FiberError", rb_eStandardError);
rb_define_singleton_method(rb_cFiber, "yield", rb_fiber_s_yield, -1);
+ rb_define_singleton_method(rb_cFiber, "current", rb_fiber_s_current, 0);
rb_define_method(rb_cFiber, "initialize", rb_fiber_initialize, -1);
rb_define_method(rb_cFiber, "blocking?", rb_fiber_blocking_p, 0);
rb_define_method(rb_cFiber, "resume", rb_fiber_m_resume, -1);
@@ -3068,6 +3069,8 @@ Init_Cont(void)
rb_define_method(rb_cFiber, "backtrace_locations", rb_fiber_backtrace_locations, -1);
rb_define_method(rb_cFiber, "to_s", fiber_to_s, 0);
rb_define_alias(rb_cFiber, "inspect", "to_s");
+ rb_define_method(rb_cFiber, "transfer", rb_fiber_m_transfer, -1);
+ rb_define_method(rb_cFiber, "alive?", rb_fiber_alive_p, 0);
rb_define_singleton_method(rb_cFiber, "blocking?", rb_f_fiber_blocking_p, 0);
rb_define_singleton_method(rb_cFiber, "scheduler", rb_fiber_scheduler, 0);
@@ -3092,6 +3095,8 @@ Init_Cont(void)
rb_define_alloc_func(rb_cFiberPool, fiber_pool_alloc);
rb_define_method(rb_cFiberPool, "initialize", rb_fiber_pool_initialize, -1);
#endif
+
+ rb_provide("fiber.so");
}
RUBY_SYMBOL_EXPORT_BEGIN
@@ -3107,15 +3112,4 @@ ruby_Init_Continuation_body(void)
rb_define_global_function("callcc", rb_callcc, 0);
}
-void
-ruby_Init_Fiber_as_Coroutine(void)
-{
-#ifdef HAVE_RB_EXT_RACTOR_SAFE
- rb_ext_ractor_safe(true);
-#endif
- rb_define_method(rb_cFiber, "transfer", rb_fiber_m_transfer, -1);
- rb_define_method(rb_cFiber, "alive?", rb_fiber_alive_p, 0);
- rb_define_singleton_method(rb_cFiber, "current", rb_fiber_s_current, 0);
-}
-
RUBY_SYMBOL_EXPORT_END
diff --git a/ext/fiber/depend b/ext/fiber/depend
deleted file mode 100644
index 675263b95c1..00000000000
--- a/ext/fiber/depend
+++ /dev/null
@@ -1,3 +0,0 @@
-# AUTOGENERATED DEPENDENCIES START
-fiber.o: fiber.c
-# AUTOGENERATED DEPENDENCIES END
diff --git a/ext/fiber/extconf.rb b/ext/fiber/extconf.rb
deleted file mode 100644
index 7f11e0dafa6..00000000000
--- a/ext/fiber/extconf.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: false
-require 'mkmf'
-create_makefile('fiber')
-
diff --git a/ext/fiber/fiber.c b/ext/fiber/fiber.c
deleted file mode 100644
index 12fcaad73b8..00000000000
--- a/ext/fiber/fiber.c
+++ /dev/null
@@ -1,8 +0,0 @@
-
-void ruby_Init_Fiber_as_Coroutine(void);
-
-void
-Init_fiber(void)
-{
- ruby_Init_Fiber_as_Coroutine();
-}