summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-12-06 22:44:37 +0100
committerBenoit Daloze <eregontp@gmail.com>2023-12-08 13:59:40 +0100
commit0204523fe7ccafba30a4d2465946095f2603c7eb (patch)
treee678f756bb85a0cc8328cb09130886f9611dcfaf /cont.c
parent7d052774bd176d013eaffecd55f6999ab31c5f68 (diff)
Improve Fiber#kill docs and simplify the NEWS entry to let the documentation explain
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cont.c b/cont.c
index 88c726927c..dceeaffa03 100644
--- a/cont.c
+++ b/cont.c
@@ -3259,6 +3259,8 @@ rb_fiber_raise(VALUE fiber, int argc, const VALUE *argv)
* the exception, and the third parameter is an array of callback information.
* Exceptions are caught by the +rescue+ clause of <code>begin...end</code>
* blocks.
+ *
+ * Raises +FiberError+ if called on a Fiber belonging to another +Thread+.
*/
static VALUE
rb_fiber_m_raise(int argc, VALUE *argv, VALUE self)
@@ -3270,12 +3272,18 @@ rb_fiber_m_raise(int argc, VALUE *argv, VALUE self)
* call-seq:
* fiber.kill -> nil
*
- * Terminates +fiber+ by raising an uncatchable exception, returning
- * the terminated Fiber.
+ * Terminates +fiber+ by raising an uncatchable exception.
+ * It only terminates the given Fiber and no other Fiber, returning +nil+ to
+ * another Fiber if that Fiber was calling +fiber.resume+ or +fiber.transfer+.
+ *
+ * +Fiber#kill+ only interrupts another Fiber when it is in +Fiber.yield+.
+ * If called on the current Fiber then it raises that exception at the +Fiber#kill+ call site.
*
* If the fiber has not been started, transition directly to the terminated state.
*
* If the fiber is already terminated, does nothing.
+ *
+ * Raises +FiberError+ if called on a Fiber belonging to another +Thread+.
*/
static VALUE
rb_fiber_m_kill(VALUE self)