PackageDb: Explicitly unlock package database before closing
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 29 Aug 2017 18:45:28 +0000 (14:45 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 29 Aug 2017 23:08:07 +0000 (19:08 -0400)
Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13945

Differential Revision: https://phabricator.haskell.org/D3874

libraries/ghc-boot/GHC/PackageDb.hs

index 9ce07e7..a59c46e 100644 (file)
@@ -267,7 +267,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