# Io\_splice 2.0.0 - IO::Splice.copy\_stream fixes

**URL:** <https://www.ruby-forum.com/t/io-splice-2-0-0-io-splice-copy-stream-fixes/189742>\
**Category:** Ruby\
**Created:** [June 6, 2010, 10:44pm UTC](https://www.ruby-forum.com/t/io-splice-2-0-0-io-splice-copy-stream-fixes/189742 "2010-06-06T22:44:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/97f17d/32.png) [@ericw](https://www.ruby-forum.com/u/ericw)\
**Post date:** [June 6, 2010, 10:44pm UTC](https://www.ruby-forum.com/t/io-splice-2-0-0-io-splice-copy-stream-fixes/189742/1 "2010-06-06T22:44:32Z")

</div>

- [io\_splice - zero-copy pipe I/O for Linux and Ruby](http://bogomips.org/ruby_io_splice/)
- removed\_email\_address@domain.invalid
- git://git.bogomips.org/ruby\_io\_splice.git

Changes:

This fixes the issue with our copy\_stream where non-pipe  
descriptors with the O\_NONBLOCK flag set were not handled  
correctly. Like IO.copy\_stream in Ruby 1.9, our  
IO::Splice.copy\_stream will _always_ block until IO is available  
(or raise if there are errors).

IO::Splice.copy\_stream now closes all file descriptors that were  
opened within the method, reducing pressure on the garbage  
collector.

There are also new singleton convenience methods:

- IO::Splice.full - blocks and splices the full amount
- IO::Splice.partial - blocks until something is spliceable

They are used internally to implement IO::Splice.copy\_stream,  
but may also be useful to end users.

Rcov shows 100% test coverage \o/

---

<div class="post-metadata">

**Author:** ![ericw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/97f17d/32.png) [@ericw](https://www.ruby-forum.com/u/ericw)\
**Post date:** [June 24, 2010, 8:56pm UTC](https://www.ruby-forum.com/t/io-splice-2-0-0-io-splice-copy-stream-fixes/189742/2 "2010-06-24T20:56:21Z")

</div>

Eric W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> - [io\_splice - zero-copy pipe I/O for Linux and Ruby](http://bogomips.org/ruby_io_splice/)
> - removed\_email\_address@domain.invalid
> - git://git.bogomips.org/ruby\_io\_splice.git
> 
> Changes:

Oops, I screwed up the Subject: line in the original announcement.

I also just tried this release under Rubinius and it works as of  
Rubinius commit db6ea50cacb1b2b246ee445f03ae4ffec3015a07. I  
even found a bug in my test cases triggered by Rubinius, but  
the actual library works fine.
