Fix FileStream.FlushAsync() to behave like Flush() (dotnet/coreclr#24902)
authorStephen Toub <stoub@microsoft.com>
Fri, 31 May 2019 23:41:59 +0000 (19:41 -0400)
committerGitHub <noreply@github.com>
Fri, 31 May 2019 23:41:59 +0000 (19:41 -0400)
commita123fb2c0a135aa7263f7aeb92e0b67d3917c9c2
tree334837af6e268ea6517436ee36dabb4ca962e694
parent9c2608cb117a1d9e482be1738764b0377f24b76d
Fix FileStream.FlushAsync() to behave like Flush() (dotnet/coreclr#24902)

Flush() behaves like Flush(false) and writes out any buffered data but doesn't P/Invoke to FlushFileBuffers/FSync to flush the OS buffers.

But whereas FlushAsync() is supposed to just be an async equivalent of Flush(), it's actually behaving like Flush(true).  This makes FlushAsync() inconsistent and much more expensive.  (This is separate from FlushAsync not actually being async, which is an impactful problem to be solved separately.)

This changes FlushAsync to behave like Flush()/Flush(false) rather than Flush(true).  If someone wants the FlushFileBuffers/FSync behavior, they can call Flush(true).

Commit migrated from https://github.com/dotnet/coreclr/commit/436debb93c390e144f9c25b5d1922ac7780745f4
src/libraries/System.Private.CoreLib/src/System/IO/FileStream.Windows.cs