0.0
No release in over a year
This is a task scheduler which implements the FiberScheduler interface
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

⚠️ This project is still work in progress, and not published as a gem yet.

AsyncScheduler

CI codecov License

This is a Fiber Schduler, which is a missing piece to do concurrent programming in Ruby language.
If you are not familiar with the concept of Fiber Schduler, please refer to my presentation: Ruby の FiberScheduler を布教したい. (Sorry in Japanese.)

Installation

Add this line to your application's Gemfile:

gem 'async_scheduler'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install async_scheduler

Usage

Set this scheduler in the current thread. Then, surround each of blocking oerations in Fiber.schedule block so that they are executed concurrently.

Fiber.set_schduler AsyncScheduler::Scheduler.new

Fiber.schedule do
  File.read("file1.txt") # some blocking operation
end

Fiber.schedule do
  File.read("file2.txt") # some blocking operation
end

puts "Finished"

Development

Add and run spec.

bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kudojp/async_scheduler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the AsyncScheduler project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.