Let handles be seen outside of memfiles module so that "updating"
operations (like eg., resizing a file and re-mapping) do not need to worry about race conditions of re-opened paths, renamed parent directories and that sort of thing. Operating directly on already open handles is both safer and more efficient than relying upon the stability of filesystem paths.
This commit is contained in:
parent
cd81f368d1
commit
740c5b13ea
1 changed files with 4 additions and 4 deletions
|
|
@ -36,11 +36,11 @@ type
|
|||
size*: int ## size of the memory mapped file
|
||||
|
||||
when defined(windows):
|
||||
fHandle: Handle
|
||||
mapHandle: Handle
|
||||
wasOpened: bool ## only close if wasOpened
|
||||
fHandle*: Handle
|
||||
mapHandle*: Handle
|
||||
wasOpened*: bool ## only close if wasOpened
|
||||
else:
|
||||
handle: cint
|
||||
handle*: cint
|
||||
|
||||
proc mapMem*(m: var MemFile, mode: FileMode = fmRead,
|
||||
mappedSize = -1, offset = 0): pointer =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue