Example #1
0
        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();
                }
            }
        }
Example #2
0
 public static bool BindHandle(IntPtr osHandle)
 {
     return(ThreadPool.BindIOCompletionCallbackNative(osHandle));
 }