File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -642,7 +642,8 @@ setNonTestThread tid@ThreadId{} = tid
642
642
newtype TVarId = TVarId Int deriving (Eq , Ord , Enum , Show )
643
643
newtype TimeoutId = TimeoutId Int deriving (Eq , Ord , Enum , Show )
644
644
newtype ClockId = ClockId [Int ] deriving (Eq , Ord , Show )
645
- newtype VectorClock = VectorClock (Map ThreadId Int ) deriving Show
645
+ newtype VectorClock = VectorClock { getVectorClock :: Map ThreadId Int }
646
+ deriving Show
646
647
647
648
unTimeoutId :: TimeoutId -> Int
648
649
unTimeoutId (TimeoutId a) = a
Original file line number Diff line number Diff line change @@ -121,8 +121,13 @@ lubVClock (VectorClock m) (VectorClock m') = VectorClock (Map.unionWith max m m'
121
121
-- hbfVClock :: VectorClock -> VectorClock -> Bool
122
122
-- hbfVClock (VectorClock m) (VectorClock m') = Map.isSubmapOfBy (<=) m m'
123
123
124
- hbfStep :: ThreadId -> Int -> VectorClock -> Bool
125
- hbfStep tid tstep (VectorClock m) = Just tstep <= Map. lookup tid m
124
+ happensBeforeStep :: Step -- ^ an earlier step
125
+ -> Step -- ^ a later step
126
+ -> Bool
127
+ happensBeforeStep step step' =
128
+ Just (stepStep step)
129
+ <= Map. lookup (stepThreadId step)
130
+ (getVectorClock $ stepVClock step')
126
131
127
132
labelledTVarId :: TVar s a -> ST s (Labelled TVarId )
128
133
labelledTVarId TVar { tvarId, tvarLabel } = (Labelled tvarId) <$> readSTRef tvarLabel
@@ -1357,7 +1362,7 @@ updateRaces newStep@Step{ stepThreadId = tid, stepEffect = newEffect }
1357
1362
let lessConcurrent = foldr Set. delete concurrent (effectWakeup newEffect) in
1358
1363
if tid `elem` concurrent then
1359
1364
let theseStepsRace = not (isTestThreadId tid) && racingSteps step newStep
1360
- happensBefore = hbfStep (stepThreadId step) (stepStep step) (stepVClock newStep)
1365
+ happensBefore = happensBeforeStep step newStep
1361
1366
nondep' | happensBefore = nondep
1362
1367
| otherwise = newStep : nondep
1363
1368
-- We will only record the first race with each thread---reversing
You can’t perform that action at this time.
0 commit comments