public static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
{
if (handle == null)
{
throw new ArgumentNullException("handle");
}
if (handle.IsClosed || handle.IsInvalid)
{
throw new ArgumentException("Invalid Handle", "handle");
}
try
{
ThreadPool.BindHandle(handle);
}
catch (Exception expr_38)
{
if (expr_38.HResult == -2147024890)
{
throw new ArgumentException("Invalid Handle", "handle");
}
if (expr_38.HResult == -2147024809)
{
throw new ArgumentException("Already Bound", "handle");
}
throw;
}
return(new ThreadPoolBoundHandle(handle));
}