CL 196846 implemented memory mapped output files but forgot to provide
an implementation for Msync. This rectifies that with a simple call to
FlushViewOfFile.
Change-Id: I5aebef9baf3a2a6ad54ceda096952a5d7d660bfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/198418
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
}
func (out *OutBuf) Msync() error {
- // does nothing on windows
- return nil
+ if out.buf == nil {
+ return nil
+ }
+ return syscall.FlushViewOfFile(uintptr(unsafe.Pointer(&out.buf[0])), 0)
}