0.01
No release in over 3 years
Low commit activity in last 3 years
Libev-based fiber scheduler for Ruby 3.0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

libev_scheduler

Ruby gem Tests MIT License

libev_scheduler is a libev-based fiber scheduler for Ruby 3.0 based on code extracted from Polyphony.

Installing

$ gem install libev_scheduler

Usage

Fiber.set_scheduler Libev::Scheduler.new

Fiber.schedule do
  do_something_awesome
end

Also have a look at the included tests and examples.

The scheduler implementation

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 Ruby fiber scheduler interface

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:

  • starting a non-blocking fiber
  • waiting for an IO instance to become ready for reading or writing
  • sleeping for a certain time duration
  • waiting for a process to terminate
  • otherwise pausing/resuming fibers (blocking/unblocking) for use with mutexes, condition variables, queues etc.

Here are some of my thoughts on this interface.