/*
 * call-seq:
 *   ZMQ.select(in, out=[], err=[], timeout=nil) -> [in, out, err] | nil
 *
 * Like IO.select, but also works with 0MQ sockets.
 */
static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
{
    VALUE readset, writeset, errset, timeout;
    rb_scan_args (argc_, argv_, "13", &readset, &writeset, &errset, &timeout);

    long timeout_usec;

    if (!NIL_P (readset)) Check_Type (readset, T_ARRAY);
    if (!NIL_P (writeset)) Check_Type (writeset, T_ARRAY);
    if (!NIL_P (errset)) Check_Type (errset, T_ARRAY);
    
    if (NIL_P (timeout))
        timeout_usec = -1;
    else
        timeout_usec = (long)(NUM2DBL (timeout) * 1000000);

    return module_select_internal(readset, writeset, errset, timeout_usec);
}