Project

General

Profile

Bug #3728 ยป issue3728.patch

eitoball (Eito Katagiri), 09/07/2010 10:24 PM

View differences:

io.c
7343 7343
 *               [, error_array
7344 7344
 *               [, timeout]]] )-> array  or  nil
7345 7345
 *
7346
 *  See <code>Kernel#select</code>.
7346
 *  Calls select(2) system call.
7347
 *  It returns an array that contains arrays of IO objects that are ready
7348
 *  for *  reading, are ready for writing, and have pending exceptions
7349
 *  respectably. It returns nil on timeout.
7350
 *
7351
 *      rp, wp = IO.pipe
7352
 *      mesg = "ping "
7353
 *      100.times {
7354
 *        rs, ws, = IO.select([rp], [wp])
7355
 *        if r = rs[0]
7356
 *          ret = r.read(5)
7357
 *          print ret
7358
 *          case ret
7359
 *          when /ping/
7360
 *            mesg = "pong\n"
7361
 *          when /pong/
7362
 *            mesg = "ping "
7363
 *          end
7364
 *        end
7365
 *        if w = ws[0]
7366
 *          w.write(mesg)
7367
 *        end
7368
 *      }
7369
 *
7370
 *  <em>produces:</em>
7371
 *
7372
 *      ping pong
7373
 *      ping pong
7374
 *      ping pong
7375
 *      (snipped)
7376
 *      ping
7347 7377
 */
7348

  
7349 7378
static VALUE
7350 7379
rb_f_select(int argc, VALUE *argv, VALUE obj)
7351 7380
{