Free() private method

private Free ( System nativeOverlappedPtr ) : void
nativeOverlappedPtr System
return void
Exemplo n.º 1
0
 unsafe void IDeferredDisposable.OnFinalRelease(bool disposed)
 {
     if (disposed)
     {
         Overlapped.Free(this._overlapped._nativeOverlapped);
         return;
     }
     this._overlapped._boundHandle       = null;
     this._overlapped._completed         = false;
     *this._overlapped._nativeOverlapped = default(NativeOverlapped);
 }
 unsafe void IDeferredDisposable.OnFinalRelease(bool disposed)
 {
     if (_overlapped != null)
     {
         if (disposed)
         {
             Overlapped.Free(_overlapped._nativeOverlapped);
         }
         else
         {
             _overlapped._boundHandle = null;
             _overlapped._completed   = false;
             *_overlapped._nativeOverlapped = default(NativeOverlapped);
         }
     }
 }
Exemplo n.º 3
0
        public unsafe void FreeNativeOverlapped(NativeOverlapped *overlapped)
        {
            if (overlapped == null)
            {
                throw new ArgumentNullException("overlapped");
            }
            ThreadPoolBoundHandleOverlapped overlappedWrapper = ThreadPoolBoundHandle.GetOverlappedWrapper(overlapped, this);

            if (overlappedWrapper._boundHandle != this)
            {
                throw new ArgumentException("Wrong bound handle", "overlapped");
            }
            if (overlappedWrapper._preAllocated != null)
            {
                overlappedWrapper._preAllocated.Release();
                return;
            }
            Overlapped.Free(overlapped);
        }
Exemplo n.º 4
0
        public unsafe void FreeNativeOverlapped(NativeOverlapped *overlapped)
        {
            ArgumentNullException.ThrowIfNull(overlapped);

            // Note: we explicitly allow FreeNativeOverlapped calls after the ThreadPoolBoundHandle has been Disposed.

            ThreadPoolBoundHandleOverlapped wrapper = GetOverlappedWrapper(overlapped);

            if (wrapper._boundHandle != this)
            {
                throw new ArgumentException(SR.Argument_NativeOverlappedWrongBoundHandle, nameof(overlapped));
            }

            if (wrapper._preAllocated != null)
            {
                wrapper._preAllocated.Release();
            }
            else
            {
                Overlapped.Free(overlapped);
            }
        }