* ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah

[Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the
  original discussion from documenting-ruby/ruby#18


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2013-10-16 20:54:23 +00:00
Родитель 82d06c5ade
Коммит 64afa78e8a
2 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Thu Oct 17 05:52:31 2013 Zachary Scott <e@zzak.io>
* ext/io/nonblock/nonblock.c: [DOC] Document io/nonblock by reprah
[Fixes GH-418] https://github.com/ruby/ruby/pull/418 based on the
original discussion from documenting-ruby/ruby#18
Thu Oct 17 05:40:33 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (objspace_each_objects): do not skip empty RVALUEs.

Просмотреть файл

@ -30,6 +30,12 @@ io_nonblock_mode(int fd)
#endif
#ifdef F_GETFL
/*
* call-seq:
* io.nonblock? -> boolean
*
* Returns +true+ if an IO object is in non-blocking mode.
*/
static VALUE
rb_io_nonblock_p(VALUE io)
{
@ -61,6 +67,13 @@ io_nonblock_set(int fd, int f, int nb)
rb_sys_fail(0);
}
/*
* call-seq:
* io.nonblock = boolean -> boolean
*
* Enables non-blocking mode on a stream when set to
* +true+, and blocking mode when set to +false+.
*/
static VALUE
rb_io_nonblock_set(VALUE io, VALUE nb)
{
@ -79,6 +92,16 @@ io_nonblock_restore(VALUE arg)
return Qnil;
}
/*
* call-seq:
* io.nonblock {|io| } -> io
* io.nonblock(boolean) {|io| } -> io
*
* Yields +self+ in non-blocking mode.
*
* When +false+ is given as an argument, +self+ is yielded in blocking mode.
* The original mode is restored after the block is executed.
*/
static VALUE
rb_io_nonblock_block(int argc, VALUE *argv, VALUE io)
{