public static bool BindHandle(SafeHandle osHandle) { if (osHandle == null) { throw new ArgumentNullException("osHandle"); } bool success = false; RuntimeHelpers.PrepareConstrainedRegions(); try { osHandle.DangerousAddRef(ref success); return(ThreadPool.BindIOCompletionCallbackNative(osHandle.DangerousGetHandle())); } finally { if (success) { osHandle.DangerousRelease(); } } }
public static bool BindHandle(IntPtr osHandle) { return(ThreadPool.BindIOCompletionCallbackNative(osHandle)); }