libev_scheduler
is a libev-based fiber scheduler for Ruby 3.0 based on code
extracted from Polyphony.
$ gem install libev_scheduler
Fiber.set_scheduler Libev::Scheduler.new
Fiber.schedule do
do_something_awesome
end
Also have a look at the included tests and examples.
The present gem uses libev to provide a performant, cross-platform fiber scheduler implementation for Ruby 3.0. The bundled libev is version 4.33, which includes an (experimental) io_uring backend.
The fiber scheduler interface is a new feature in Ruby 3.0, aimed at facilitating building fiber-based concurrent applications in Ruby. The current specification includes methods for:
IO
instance to become ready for reading or writingHere are some of my thoughts on this interface.