diff options
Diffstat (limited to 'src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs')
-rw-r--r-- | src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs b/src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs index d0cc5afbae..a4a3b980cf 100644 --- a/src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs +++ b/src/mscorlib/src/System/Threading/ClrThreadPoolBoundHandle.cs @@ -83,28 +83,7 @@ namespace System.Threading if (handle.IsClosed || handle.IsInvalid) throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle)); - try - { - // ThreadPool.BindHandle will always return true, otherwise, it throws. See the underlying FCall - // implementation in ThreadPoolNative::CorBindIoCompletionCallback to see the implementation. - bool succeeded = ThreadPool.BindHandle(handle); - Debug.Assert(succeeded); - } - catch (Exception ex) - { // BindHandle throws ApplicationException on full CLR and Exception on CoreCLR. - // We do not let either of these leak and convert them to ArgumentException to - // indicate that the specified handles are invalid. - - if (ex.HResult == System.HResults.E_HANDLE) // Bad handle - throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle)); - - if (ex.HResult == System.HResults.E_INVALIDARG) // Handle already bound or sync handle - throw new ArgumentException(SR.Argument_AlreadyBoundOrSyncHandle, nameof(handle)); - - throw; - } - - return new ThreadPoolBoundHandle(handle); + return BindHandleCore(handle); } /// <summary> |