forked from cerc-io/plugeth
consensus/ethash: close mmap before rename, windows limitation
This commit is contained in:
parent
ee05cc4a27
commit
65e1095c3f
@ -130,13 +130,16 @@ func memoryMapAndGenerate(path string, size uint64, generator func(buffer []uint
|
||||
data := buffer[len(dumpMagic):]
|
||||
generator(data)
|
||||
|
||||
if err := mem.Flush(); err != nil {
|
||||
mem.Unmap()
|
||||
dump.Close()
|
||||
if err := mem.Unmap(); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
os.Rename(temp, path)
|
||||
return dump, mem, data, nil
|
||||
if err := dump.Close(); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if err := os.Rename(temp, path); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
return memoryMap(path)
|
||||
}
|
||||
|
||||
// cache wraps an ethash cache with some metadata to allow easier concurrent use.
|
||||
|
Loading…
Reference in New Issue
Block a user