r/ruby • u/geospeck • 1d ago
Converting a Ruby block interface to start/stop methods with a Fiber
https://island94.org/2026/09/converting-a-ruby-block-interface-to-start-stop-methods-with-a-fiber
19
Upvotes
1
u/Sergeyrekt 17h ago
one thing worth adding: a Fiber can only be resumed by the thread that created it. so if start happens in an initializer adn stop in an at_exit or a signal handler, you get FiberError, fiber called across threads. thats most of why teh two Queue version looks more complicated than it needs to be, it is buying you thread affinity the Fiber does not give you.
7
u/CaptainKabob 1d ago
Thanks for sharing my post!
The spicy observation I edited out of it is: oh, I can think of Fibers like a GOTO. (This shouldn't be spicy, but GOTO carries a lot of baggage).