Hello all,
I''ve released kgio, a kinder, gentler I/O library for Ruby. Some of
its
features are useful for Unicorn, and all of it is useful for Rainbows!
I intend to make kgio a requirement for both Unicorn and
Rainbows!/Zbatery. I''m comfortable with the code, but extra testers
and
extra eyes to review it would be helpful (it''s nearly all C).
There were several factors leading the creation of this library:
1. The performance loss from Ruby 1.9.2 due to extending exceptions
with IO::Wait{Read,Writ}able is annoying. While it''s partly
fixed[1] and fixable[2] for 1.9.3, it could be a while before
1.9.3 is available. Unicorn currently does non-blocking accept
very aggressively.
2. (Rainbows! only) Slicing partially written strings for
non-blocking I/O in gets painful with Ruby 1.9, it''s much easier
(at least for me) to do this in C and kgio_trywrite allows
exactly that, returning the unwritten portion of a string.
3. (Rainbows! only) It offers hooks for using alternative
methods to switch execution contexts (experience taken from
building the FiberSpawn/FiberPool modules).
4. (philosophical) I''ve never considered EAGAIN/EINPROGRESS
"exceptional" conditions when explicitly doing non-blocking
I/O, and thus unworthy of raising exceptions.
kgio currently passes all tests on on Linux 2.6 (1.9.{1,2},
1.8.{6,7}, rbx 1.1) and FreeBSD 7.0 (1.8.7).
http://unicorn.bogomips.org/kgio/
git://git.bogomips.org/kgio.git
http://git.bogomips.org/cgit/kgio.git
[1] - http://thread.gmane.org/gmane.comp.lang.ruby.core/30854
[2] - http://thread.gmane.org/gmane.comp.lang.ruby.core/31801
--
Eric Wong