summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-06-22 13:48:52 +0200
committerBen Gamari <ben@smart-cactus.org>2020-07-15 16:41:03 -0400
commit6a533d2afaab8b8ca0026c9af1a8ed9ff09c4462 (patch)
treee8adc75b7fce82c3431347669204a90139344c27 /libraries
parentf8d39a510c563271e26ec7175b8e538d0b6809da (diff)
downloadhaskell-6a533d2afaab8b8ca0026c9af1a8ed9ff09c4462.tar.gz
winio: add a note about file locking in the RTS.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/GHC/IO/FD.hs1
-rw-r--r--libraries/base/GHC/IO/Windows/Handle.hsc1
2 files changed, 2 insertions, 0 deletions
diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs
index 9e1a8cf08e..4245bf0b26 100644
--- a/libraries/base/GHC/IO/FD.hs
+++ b/libraries/base/GHC/IO/FD.hs
@@ -264,6 +264,7 @@ mkFD fd iomode mb_stat is_socket is_nonblock = do
RegularFile -> do
-- On Windows we need an additional call to get a unique device id
-- and inode, since fstat just returns 0 for both.
+ -- See also Note [RTS File locking]
(unique_dev, unique_ino) <- getUniqueFileInfo fd dev ino
r <- lockFile (fromIntegral fd) unique_dev unique_ino
(fromBool write)
diff --git a/libraries/base/GHC/IO/Windows/Handle.hsc b/libraries/base/GHC/IO/Windows/Handle.hsc
index 1efabb3dbd..4d7e3e393f 100644
--- a/libraries/base/GHC/IO/Windows/Handle.hsc
+++ b/libraries/base/GHC/IO/Windows/Handle.hsc
@@ -818,6 +818,7 @@ openFile' filepath iomode non_blocking tmp_opts =
case _type of
-- Regular files need to be locked.
+ -- See also Note [RTS File locking]
RegularFile -> do
optimizeFileAccess h -- Set a few optimization flags on file handles.
(unique_dev, unique_ino) <- getUniqueFileInfo hwnd