Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/digital-fabric/libev_scheduler
A libev-based fiber scheduler for Ruby 3.0
https://github.com/digital-fabric/libev_scheduler
Last synced: 11 days ago
JSON representation
A libev-based fiber scheduler for Ruby 3.0
- Host: GitHub
- URL: https://github.com/digital-fabric/libev_scheduler
- Owner: digital-fabric
- License: mit
- Created: 2021-01-03T05:01:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-01T05:14:22.000Z (over 1 year ago)
- Last Synced: 2024-09-20T03:08:50.490Z (about 2 months ago)
- Language: C
- Homepage:
- Size: 472 KB
- Stars: 34
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# libev_scheduler
`libev_scheduler` is a libev-based fiber scheduler for Ruby 3.0 based on code
extracted from [Polyphony](https://github.com/digital-fabric/polyphony).## Installing
```bash
$ gem install libev_scheduler
```## Usage
```ruby
Fiber.set_scheduler Libev::Scheduler.newFiber.schedule do
do_something_awesome
end
```Also have a look at the included tests and examples.
## The scheduler implementation
The present gem uses
[libev](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod) 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](https://docs.ruby-lang.org/en/master/Fiber/SchedulerInterface.html)
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](thoughts.md) on this interface.