| ... | ... | @@ -1314,11 +1314,12 @@ pub fn unmap(mf: *MappedFile) void { |
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { |
| 1317 | | mf.memory_map.write(mf.io) catch |err| switch (err) { |
| 1317 | mf.flushInner() catch |err| switch (err) { |
| 1318 | 1318 | error.Canceled => |e| return e, |
| 1319 | 1319 | |
| 1320 | 1320 | error.WouldBlock, // file was not opened as non-blocking |
| 1321 | 1321 | error.NotOpenForWriting, // we definitely opened the file for writing |
| 1322 | error.ReadOnlyFileSystem, |
| 1322 | 1323 | => { |
| 1323 | 1324 | mf.io_err = error.Unexpected; |
| 1324 | 1325 | return error.MappedFileIo; |
| ... | ... | @@ -1331,6 +1332,11 @@ pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { |
| 1331 | 1332 | }; |
| 1332 | 1333 | } |
| 1333 | 1334 | |
| 1335 | fn flushInner(mf: *MappedFile) (Io.File.WritePositionalError || Io.File.SetTimestampsError)!void { |
| 1336 | try mf.memory_map.write(mf.io); |
| 1337 | if (is_windows) try mf.memory_map.file.setTimestampsNow(mf.io); |
| 1338 | } |
| 1339 | |
| 1334 | 1340 | fn verify(mf: *MappedFile) void { |
| 1335 | 1341 | const root = Node.Index.root.get(mf); |
| 1336 | 1342 | assert(root.parent == .none); |