Created
August 5, 2009 11:51
-
-
Save methodmissing/162652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE | |
| internal_read_func(void *ptr) | |
| { | |
| struct io_internal_struct *iis = (struct io_internal_struct*)ptr; | |
| return read(iis->fd, iis->buf, iis->capa); | |
| } | |
| static VALUE | |
| internal_write_func(void *ptr) | |
| { | |
| struct io_internal_struct *iis = (struct io_internal_struct*)ptr; | |
| return write(iis->fd, iis->buf, iis->capa); | |
| } | |
| static int | |
| rb_read_internal(int fd, void *buf, size_t count) | |
| { | |
| struct io_internal_struct iis; | |
| iis.fd = fd; | |
| iis.buf = buf; | |
| iis.capa = count; | |
| return rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); | |
| } | |
| static int | |
| rb_write_internal(int fd, void *buf, size_t count) | |
| { | |
| struct io_internal_struct iis; | |
| iis.fd = fd; | |
| iis.buf = buf; | |
| iis.capa = count; | |
| return rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment