@@ -52,7 +52,6 @@ import qualified Data.Map as Map
5252import Control.Concurrent.MVar
5353import Data.IORef
5454import System.IO.Unsafe (unsafePerformIO )
55- --- BEGIN MODIFICATION: Locking Mechanism ---
5655
5756-- Global state for locks, one MVar per build directory path.
5857-- The MVar () acts as a mutex: it's full when the lock is available (unlocked),
@@ -72,7 +71,6 @@ getOrCreateLock path = do
7271 case Map. lookup path currentMap of
7372 Just existingLock -> (currentMap, existingLock) -- Lock already exists, return it. The newLock we created is discarded.
7473 Nothing -> (Map. insert path newLock currentMap, newLock) -- New lock inserted, return it.
75- --- END MODIFICATION: Locking Mechanism ---
7674
7775runConfigureScript
7876 :: ConfigFlags
@@ -205,10 +203,9 @@ runConfigureScript cfg flags programDb hp = do
205203 lookupProgram shProg
206204 `fmap` configureProgram verbosity shProg progDb
207205
208- --- BEGIN MODIFICATION: Apply Locking ---
209206 -- Acquire the lock specific to this build_dir
210207 -- build_dir is used as the key for the lock.
211- configureLock <- getOrCreateLock (interpretSymbolicPath mbWorkDir build_dir)
208+ configureLock <- getOrCreateLock configureFile'
212209
213210 let runLockedConfigureAction = do
214211 case shConfiguredProg of
@@ -222,14 +219,14 @@ runConfigureScript cfg flags programDb hp = do
222219 }
223220 Nothing -> dieWithException verbosity NotFoundMsg
224221
225- warn verbosity $ " Attempting to acquire configure lock for " ++ interpretSymbolicPath mbWorkDir build_dir
222+ warn verbosity $ " Attempting to acquire configure lock for " ++ configureFile'
226223 -- withMVar takes the MVar (blocks if already taken), runs the action,
227224 -- and ensures the MVar is put back, even if the action throws an exception.
228225 withMVar configureLock $ \ () ->
229226 -- The '()' means the MVar holds a unit value; we're interested in its full/empty state.
230227 runLockedConfigureAction
231- warn verbosity $ " Configure lock released for " ++ interpretSymbolicPath mbWorkDir build_dir
232- --- END MODIFICATION: Apply Locking ---
228+ warn verbosity $ " Configure lock released for " ++ configureFile'
229+
233230 where
234231 args = configureArgs backwardsCompatHack cfg
235232 backwardsCompatHack = False
0 commit comments