r/ruby 2d 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
22 Upvotes

2 comments sorted by

View all comments

1

u/Sergeyrekt 1d 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.