mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #21509] [DOC] Correct IO#wait
description
This commit is contained in:
parent
dbf7a0c713
commit
9e7a985c6d
1 changed files with 8 additions and 8 deletions
16
io.c
16
io.c
|
@ -9929,7 +9929,7 @@ io_event_from_value(VALUE value)
|
|||
/*
|
||||
* call-seq:
|
||||
* io.wait(events, timeout) -> event mask, false or nil
|
||||
* io.wait(timeout = nil, mode = :read) -> self, true, or false
|
||||
* io.wait(*event_symbols[, timeout]) -> self, true, or false
|
||||
*
|
||||
* Waits until the IO becomes ready for the specified events and returns the
|
||||
* subset of events that become ready, or a falsy value when times out.
|
||||
|
@ -9937,10 +9937,14 @@ io_event_from_value(VALUE value)
|
|||
* The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
|
||||
* +IO::PRIORITY+.
|
||||
*
|
||||
* Returns an event mask (truthy value) immediately when buffered data is available.
|
||||
* Returns an event mask (truthy value) immediately when buffered data is
|
||||
* available.
|
||||
*
|
||||
* Optional parameter +mode+ is one of +:read+, +:write+, or
|
||||
* +:read_write+.
|
||||
* The second form: if one or more event symbols (+:read+, +:write+, or
|
||||
* +:read_write+) are passed, the event mask is the bit OR of the bitmask
|
||||
* corresponding to those symbols. In this form, +timeout+ is optional, the
|
||||
* order of the arguments is arbitrary, and returns +io+ if any of the
|
||||
* events is ready.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
@ -9950,10 +9954,6 @@ io_wait(int argc, VALUE *argv, VALUE io)
|
|||
enum rb_io_event events = 0;
|
||||
int return_io = 0;
|
||||
|
||||
// The documented signature for this method is actually incorrect.
|
||||
// A single timeout is allowed in any position, and multiple symbols can be given.
|
||||
// Whether this is intentional or not, I don't know, and as such I consider this to
|
||||
// be a legacy/slow path.
|
||||
if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) {
|
||||
// We'd prefer to return the actual mask, but this form would return the io itself:
|
||||
return_io = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue