summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorc-blake <c-blake@users.noreply.github.com>2017-03-12 15:45:10 -0400
committerAndreas Rumpf <rumpf_a@web.de>2017-03-12 20:45:10 +0100
commitd59441340dcc3b131c984def530084da93796775 (patch)
tree3ea6345957b615bd20443966f5b374834fd97632 /koch.nim
parent9fda97b05840a373f1e49417e7f50fa1328d7b06 (diff)
downloadNim-d59441340dcc3b131c984def530084da93796775.tar.gz
Fixes incorrect fd==0 test on Unix; Conserves handles by default. (#5512)
* Fix 2 problems.  First, 0 is a valid fd on Unix (easily gotten if user first
closes all fds and then starts using memfiles).  Use -1 instead for an invalid
fd.  Second, it is best practice to conserve open fds on Unix and file handles
on Windows.  These handles are not needed unless the user wants to remap the
memory with ``mapMem`` (or a hypothetical future ``proc resize``).  Adding a
new bool param ``allowRemap=false`` to ``memfiles.open`` solves this cleanly
in a "mostly" backward compatible way.  This is only "mostly" because the
default ``false`` case does not keep unneeded resources allocated, but that
most sensible default means that any ``mapMem`` callers need to fix all their
open calls to have allowRemap=true, as this PR also does for tmemfiles2.nim.
* Include backwards compatibility note.
Diffstat (limited to 'koch.nim')
0 files changed, 0 insertions, 0 deletions