Exemplo n.º 1
0
        public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            _overlapped = Win32ThreadPoolNativeOverlapped.Allocate(callback, state, pinData, this);
        }
Exemplo n.º 2
0
        private unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object?state, object?pinData, bool flowExecutionContext)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            _overlapped = Win32ThreadPoolNativeOverlapped.Allocate(callback, state, pinData, this, flowExecutionContext);
        }
Exemplo n.º 3
0
        public unsafe NativeOverlapped *AllocateNativeOverlapped(IOCompletionCallback callback, object state, object pinData)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            AddRef();
            try
            {
                Win32ThreadPoolNativeOverlapped *overlapped = Win32ThreadPoolNativeOverlapped.Allocate(callback, state, pinData, preAllocated: null);
                overlapped->Data._boundHandle = this;

                Interop.mincore.StartThreadpoolIo(_threadPoolHandle);

                return(Win32ThreadPoolNativeOverlapped.ToNativeOverlapped(overlapped));
            }
            catch
            {
                Release();
                throw;
            }
        }