You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -739,20 +739,20 @@ Terminates the Fiber by sending an exception inside it.
739
739
***Notes:**
740
740
* The exception sent to Fiber is _uncatchable_ (so no `rescue Exception` will notice it), so it can't be said that it has some _class_; the only usage of the fact that it is raised through exception mechanism is invoking `ensure` block;
741
741
* The fibers that was invoking the killed one with `resume` or `transfer`, receives `nil` from that call;
742
-
```ruby
743
-
f1 =Fiber.new {
744
-
# Instead of yielding something back, the fiber kills itself
745
-
Fiber.current.kill
746
-
}
747
-
748
-
f2 =Fiber.new {
749
-
result = f1.transfer
750
-
p(result:)
751
-
}
752
-
753
-
f2.resume
754
-
# prints: {:result => nil}
755
-
```
742
+
```ruby
743
+
f1 =Fiber.new {
744
+
# Instead of yielding something back, the fiber kills itself
745
+
Fiber.current.kill
746
+
}
747
+
748
+
f2 =Fiber.new {
749
+
result = f1.transfer
750
+
p(result:)
751
+
}
752
+
753
+
f2.resume
754
+
# prints: {:result => nil}
755
+
```
756
756
*Only fibers belonging to the same thread can be killed.
Copy file name to clipboardExpand all lines: _src/3.3.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -739,20 +739,20 @@ Terminates the Fiber by sending an exception inside it.
739
739
***Notes:**
740
740
* The exception sent to Fiber is _uncatchable_ (so no `rescue Exception` will notice it), so it can't be said that it has some _class_; the only usage of the fact that it is raised through exception mechanism is invoking `ensure` block;
741
741
* The fibers that was invoking the killed one with `resume` or `transfer`, receives `nil` from that call;
742
-
```ruby
743
-
f1 =Fiber.new {
744
-
# Instead of yielding something back, the fiber kills itself
745
-
Fiber.current.kill
746
-
}
747
-
748
-
f2 =Fiber.new {
749
-
result = f1.transfer
750
-
p(result:)
751
-
}
752
-
753
-
f2.resume
754
-
# prints: {:result => nil}
755
-
```
742
+
```ruby
743
+
f1 =Fiber.new {
744
+
# Instead of yielding something back, the fiber kills itself
745
+
Fiber.current.kill
746
+
}
747
+
748
+
f2 =Fiber.new {
749
+
result = f1.transfer
750
+
p(result:)
751
+
}
752
+
753
+
f2.resume
754
+
# prints: {:result => nil}
755
+
```
756
756
*Only fibers belonging to the same thread can be killed.
0 commit comments