@@ -52,7 +52,6 @@ import qualified Data.Map as Map
52
52
import Control.Concurrent.MVar
53
53
import Data.IORef
54
54
import System.IO.Unsafe (unsafePerformIO )
55
- --- BEGIN MODIFICATION: Locking Mechanism ---
56
55
57
56
-- Global state for locks, one MVar per build directory path.
58
57
-- The MVar () acts as a mutex: it's full when the lock is available (unlocked),
@@ -72,7 +71,6 @@ getOrCreateLock path = do
72
71
case Map. lookup path currentMap of
73
72
Just existingLock -> (currentMap, existingLock) -- Lock already exists, return it. The newLock we created is discarded.
74
73
Nothing -> (Map. insert path newLock currentMap, newLock) -- New lock inserted, return it.
75
- --- END MODIFICATION: Locking Mechanism ---
76
74
77
75
runConfigureScript
78
76
:: ConfigFlags
@@ -205,10 +203,9 @@ runConfigureScript cfg flags programDb hp = do
205
203
lookupProgram shProg
206
204
`fmap` configureProgram verbosity shProg progDb
207
205
208
- --- BEGIN MODIFICATION: Apply Locking ---
209
206
-- Acquire the lock specific to this build_dir
210
207
-- build_dir is used as the key for the lock.
211
- configureLock <- getOrCreateLock (interpretSymbolicPath mbWorkDir build_dir)
208
+ configureLock <- getOrCreateLock configureFile'
212
209
213
210
let runLockedConfigureAction = do
214
211
case shConfiguredProg of
@@ -222,14 +219,14 @@ runConfigureScript cfg flags programDb hp = do
222
219
}
223
220
Nothing -> dieWithException verbosity NotFoundMsg
224
221
225
- warn verbosity $ " Attempting to acquire configure lock for " ++ interpretSymbolicPath mbWorkDir build_dir
222
+ warn verbosity $ " Attempting to acquire configure lock for " ++ configureFile'
226
223
-- withMVar takes the MVar (blocks if already taken), runs the action,
227
224
-- and ensures the MVar is put back, even if the action throws an exception.
228
225
withMVar configureLock $ \ () ->
229
226
-- The '()' means the MVar holds a unit value; we're interested in its full/empty state.
230
227
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
+
233
230
where
234
231
args = configureArgs backwardsCompatHack cfg
235
232
backwardsCompatHack = False
0 commit comments