Arlodotexe / OwlCore.Storage

The most flexible file system abstraction, ever. Built in partnership with the UWP Community.
15 stars 4 forks source link

Enforced async I/O when opening a SystemFile #58

Closed itsWindows11 closed 1 week ago

itsWindows11 commented 1 week ago

By default, the stream returned from File.Open does synchronous operations on the file. We can make the underlying operating system give us an asynchronous file stream to do true async reads/writes.

Arlodotexe commented 1 week ago

For our purposes, we should fix this because when synchronous (default) is set, there's no cancellation support on the async methods of FileStream. I hadn't noticed that before, maybe I need to add CommonTests for this.

Additionally, there's a lot of sync and async-specific optimizations done to improve performance, so many that they're using the strategy pattern in the dotnet implementation of FileStream. We should definitely expose this flag on SystemFile, but this can be done in a different ticket.