@@ -312,18 +312,22 @@ io_event_from_value(VALUE value)
312312/*
313313 * call-seq:
314314 * io.wait(events, timeout) -> event mask, false or nil
315- * io.wait(timeout = nil, mode = :read ) -> self, true, or false
315+ * io.wait(*event_symbols[, timeout] ) -> self, true, or false
316316 *
317317 * Waits until the IO becomes ready for the specified events and returns the
318318 * subset of events that become ready, or a falsy value when times out.
319319 *
320320 * The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
321321 * +IO::PRIORITY+.
322322 *
323- * Returns a truthy value immediately when buffered data is available.
323+ * Returns an event mask (truthy value) immediately when buffered data is
324+ * available.
324325 *
325- * Optional parameter +mode+ is one of +:read+, +:write+, or
326- * +:read_write+.
326+ * The second form: if one or more event symbols (+:read+, +:write+, or
327+ * +:read_write+) are passed, the event mask is the bit OR of the bitmask
328+ * corresponding to those symbols. In this form, +timeout+ is optional, the
329+ * order of the arguments is arbitrary, and returns +io+ if any of the
330+ * events is ready.
327331 *
328332 * You must require 'io/wait' to use this method.
329333 */
@@ -360,10 +364,6 @@ io_wait(int argc, VALUE *argv, VALUE io)
360364 rb_io_event_t events = 0 ;
361365 int i , return_io = 0 ;
362366
363- /* The documented signature for this method is actually incorrect.
364- * A single timeout is allowed in any position, and multiple symbols can be given.
365- * Whether this is intentional or not, I don't know, and as such I consider this to
366- * be a legacy/slow path. */
367367 if (argc != 2 || (RB_SYMBOL_P (argv [0 ]) || RB_SYMBOL_P (argv [1 ]))) {
368368 /* We'd prefer to return the actual mask, but this form would return the io itself: */
369369 return_io = 1 ;
0 commit comments