PackageDb: Explicitly unlock package database before closing wip/ghc-pkg-locking
authorBen Gamari <ben@smart-cactus.org>
Mon, 21 Aug 2017 15:26:13 +0000 (11:26 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 24 Aug 2017 12:50:27 +0000 (08:50 -0400)
This is one possible cause of #13945.

libraries/ghc-boot/GHC/PackageDb.hs

index bf83d25..1dd0b1a 100644 (file)
@@ -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