241 _source.RunContinuationsAsynchronously =
true;
437 if (preallocationSize > 0)
456 sECURITY_ATTRIBUTES2.bInheritHandle =
Interop.
BOOL.TRUE;
478 safeFileHandle._fileOptions =
options;
485 fILE_ALLOCATION_INFO.AllocationSize = preallocationSize;
603 source._preallocatedOverlapped.Dispose();
static unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped *lpOverlapped)
static unsafe SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES *lpSecurityAttributes, FileMode dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile)
static bool CloseHandle(IntPtr handle)
static bool DeleteFile(string path)
static unsafe bool SetFileInformationByHandle(SafeFileHandle hFile, int FileInformationClass, void *lpFileInformation, uint dwBufferSize)
static uint GetFileType(IntPtr hFile)
static unsafe int NtQueryInformationFile(SafeFileHandle FileHandle, out IO_STATUS_BLOCK IoStatusBlock, void *FileInformation, uint Length, uint FileInformationClass)
readonly SafeFileHandle _fileHandle
void FinishedScheduling()
void Complete(uint errorCode, uint numBytes)
MemoryHandle _memoryHandle
unsafe NativeOverlapped * _overlapped
static Exception GetIOError(int errorCode, string path)
ManualResetValueTaskSourceCore< int > _source
OverlappedValueTaskSource(SafeFileHandle fileHandle)
static unsafe readonly IOCompletionCallback s_ioCallback
CancellationTokenRegistration _cancellationRegistration
OSFileStreamStrategy _strategy
unsafe NativeOverlapped * PrepareForOperation(ReadOnlyMemory< byte > memory, long fileOffset, OSFileStreamStrategy strategy=null)
void IValueTaskSource. GetResult(short token)
ValueTaskSourceStatus GetStatus(short token)
unsafe void RegisterForCancellation(CancellationToken cancellationToken)
static unsafe void IOCallback(uint errorCode, uint numBytes, NativeOverlapped *pOverlapped)
readonly PreAllocatedOverlapped _preallocatedOverlapped
unsafe void ReleaseResources()
void OnCompleted(Action< object > continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
int GetResult(short token)
void OnCompleted(Action< object > continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
IReadOnlyList< ReadOnlyMemory< byte > > _writeGatherBuffers
ValueTask< long > QueueReadScatter(IReadOnlyList< Memory< byte > > buffers, long fileOffset, CancellationToken cancellationToken)
ManualResetValueTaskSourceCore< long > _source
ValueTaskSourceStatus GetStatus(short token)
ValueTask< int > QueueRead(Memory< byte > buffer, long fileOffset, CancellationToken cancellationToken, OSFileStreamStrategy strategy)
ValueTask QueueWriteGather(IReadOnlyList< ReadOnlyMemory< byte > > buffers, long fileOffset, CancellationToken cancellationToken)
readonly SafeFileHandle _fileHandle
CancellationToken _cancellationToken
IReadOnlyList< Memory< byte > > _readScatterBuffers
long GetResult(short token)
void IValueTaskSource. GetResult(short token)
ExecutionContext _context
OSFileStreamStrategy _strategy
ReadOnlyMemory< byte > _singleSegment
ThreadPoolValueTaskSource(SafeFileHandle fileHandle)
ValueTask QueueWrite(ReadOnlyMemory< byte > buffer, long fileOffset, CancellationToken cancellationToken, OSFileStreamStrategy strategy)
ThreadPoolValueTaskSource GetThreadPoolValueTaskSource()
static unsafe void Preallocate(string fullPath, long preallocationSize, SafeFileHandle fileHandle)
static unsafe SafeFileHandle CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
ThreadPoolBoundHandle? ThreadPoolBinding
unsafe FileOptions GetFileOptions()
void InitThreadPoolBinding()
volatile FileOptions _fileOptions
OverlappedValueTaskSource _reusableOverlappedValueTaskSource
override bool ReleaseHandle()
static SafeFileHandle Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize)
OverlappedValueTaskSource GetOverlappedValueTaskSource()
ThreadPoolValueTaskSource _reusableThreadPoolValueTaskSource
void TryToReuse(OverlappedValueTaskSource source)
void EnsureThreadPoolBindingInitialized()
SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle)
static int GetRootLength(ReadOnlySpan< char > path)
static unsafe void WriteAtOffset(SafeFileHandle handle, ReadOnlySpan< byte > buffer, long fileOffset)
static unsafe int ReadAtOffset(SafeFileHandle handle, Span< byte > buffer, long fileOffset)
static void WriteGatherAtOffset(SafeFileHandle handle, IReadOnlyList< ReadOnlyMemory< byte > > buffers, long fileOffset)
static long ReadScatterAtOffset(SafeFileHandle handle, IReadOnlyList< Memory< byte > > buffers, long fileOffset)
void OnIncompleteOperation(int expectedBytesTransferred, int actualBytesTransferred)
static Exception GetExceptionForWin32Error(int errorCode, string path="")
static int GetLastPInvokeError()
void SetHandle(IntPtr handle)
static string IO_FileTooLarge_Path_AllocationSize
static string Format(string resourceFormat, object p1)
static string IO_BindHandleFailed
static string IO_DiskFull_Path_AllocationSize
static ? ExecutionContext Capture()
static int CompareExchange(ref int location1, int value, int comparand)
static int Exchange(ref int location1, int value)
static PreAllocatedOverlapped UnsafeCreate(IOCompletionCallback callback, object? state, object? pinData)
static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
unsafe void FreeNativeOverlapped(NativeOverlapped *overlapped)
unsafe NativeOverlapped * AllocateNativeOverlapped(IOCompletionCallback callback, object? state, object? pinData)
static unsafe? object GetNativeOverlappedState(NativeOverlapped *overlapped)
static bool UnsafeQueueUserWorkItem(WaitCallback callBack, object? state)
static void Write(ref bool location, bool value)
static Exception CreateEndOfFileException()
void GetResult(short token)
ValueTaskSourceOnCompletedFlags
unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP)
static readonly IntPtr Zero
unsafe ReadOnlySpan< T > Span
bool IsCancellationRequested
void SetResult(TResult result)
ValueTaskSourceStatus GetStatus(short token)
TResult GetResult(short token)
void OnCompleted(Action< object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
void SetException(Exception error)