/// <summary>
/// Call <c>select()</c> on the CurlEasy objects.
/// </summary>
/// <param name="timeoutMillis">
/// The timeout for the internal <c>select()</c> call,
/// in milliseconds.
/// </param>
/// <returns>
/// Number or <see cref="CurlEasy" /> objects with pending reads.
/// </returns>
/// <exception cref="System.NullReferenceException">
/// This is thrown if the native <c>CurlMulti</c> handle wasn't
/// created successfully.
/// </exception>
public int Select(int timeoutMillis)
{
ensureHandle();
#if USE_LIBCURLSHIM
return(NativeMethods.curl_shim_select(_maxFd + 1, _fdSets, timeoutMillis));
#else
var timeout = NativeMethods.timeval.Create(timeoutMillis);
return(NativeMethods.select(_maxFd + 1, ref _fd_read, ref _fd_write, ref _fd_except, ref timeout));
//return NativeMethods.select2(_maxFd + 1, _fd_read, _fd_write, _fd_except, timeout);
#endif
}