Warped is an I/O library for crazies. It provides an asynchronous I/O interface so that single threaded applications can issue multiple I/O operations simultaneously. Depending on the OS, type of I/O endpoint, and the underlying implementation, the I/O operations themselves may be executed asynchronously by the OS, in another thread, or in a non-blocking manner. Some care has been taken with the API to minimize the number of memory copies and context switches needed to satisfy any given request.
- You're writing a non-blocking I/O framework (i.e. webserver)
- You want to simulate blocking I/O in userspace
- You want performance AND concurrency simultaneously (…which is all relative since this is still Ruby)
- You want to use your own event loop or integrate with another system's event loop
- Your application reads or writes files
- You don't want data pushed at you through a callback-based API
- You want an API performs complete I/O operations (not just alerts you when a socket is readable/writable)
- Your application reads or writes files
- You want an API that potentially shuffles fewer bytes around
There's a simple thread pool that executes blocks asynchronously. I don't know why I had to write this, but existing Ruby thread pool libraries are terrible for a variety of reasons.
Basically everything.
Add this line to your application's Gemfile:
gem 'warped'
And then execute:
$ bundle
Or install it yourself as:
$ gem install warped
There is no API yet
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request