[commit: ghc] wip/ghc-pkg-locking: PackageDb: Explicitly unlock package database before closing (0ef79d5)

git at git.haskell.org git at git.haskell.org
Thu Aug 24 12:50:47 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/ghc-pkg-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/0ef79d5be44f87aecb2f85192e21af927374b5b8/ghc

>---------------------------------------------------------------

commit 0ef79d5be44f87aecb2f85192e21af927374b5b8
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Aug 21 11:26:13 2017 -0400

    PackageDb: Explicitly unlock package database before closing
    
    This is one possible cause of #13945.


>---------------------------------------------------------------

0ef79d5be44f87aecb2f85192e21af927374b5b8
 libraries/ghc-boot/GHC/PackageDb.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs
index bf83d25..1dd0b1a 100644
--- a/libraries/ghc-boot/GHC/PackageDb.hs
+++ b/libraries/ghc-boot/GHC/PackageDb.hs
@@ -261,7 +261,11 @@ lockPackageDbWith mode file = do
                    return $ PackageDbLock hnd
 
 lockPackageDb = lockPackageDbWith ExclusiveLock
-unlockPackageDb (PackageDbLock hnd) = hClose hnd
+unlockPackageDb (PackageDbLock hnd) = do
+#if MIN_VERSION_base(4,11,0)
+    hUnlock hnd
+#endif
+    hClose hnd
 
 -- MIN_VERSION_base(4,10,0)
 #else



More information about the ghc-commits mailing list