summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorCharles Blake <cb@cblake.net>2018-12-10 11:40:08 -0500
committerCharles Blake <cb@cblake.net>2018-12-10 11:40:08 -0500
commit740c5b13ead2fe02691554ef9b585d7cb4ba19fa (patch)
tree7678915dd330fd615188b9f32d0a5848a2ba348a /lib
parentcd81f368d184dae6268ccf5f4bdc771a661f4ac1 (diff)
downloadNim-740c5b13ead2fe02691554ef9b585d7cb4ba19fa.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/memfiles.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim
index e5345e645..61eff3295 100644
--- a/lib/pure/memfiles.nim
+++ b/lib/pure/memfiles.nim
@@ -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 =