Skip to content

Commit 7293991

Browse files
committed
io-sim-por: exclude forked threads from concurrent threads
Threads which are forked by the current step cannot race with it.
1 parent 396aeab commit 7293991

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

io-sim/src/Control/Monad/IOSimPOR/Internal.hs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,12 +1387,17 @@ noRaces = Races [] []
13871387

13881388
updateRacesInSimState :: Thread s a -> SimState s a -> Races
13891389
updateRacesInSimState thread SimState{ control, threads, races } =
1390-
traceRaces $
1391-
updateRaces (currentStep thread)
1392-
(threadBlocked thread)
1393-
control
1394-
(Map.keysSet (Map.filter (not . threadDone) threads))
1395-
races
1390+
traceRaces $
1391+
updateRaces step
1392+
(threadBlocked thread)
1393+
control
1394+
(Map.keysSet (Map.filter (\t -> not (threadDone t)
1395+
&& threadId t `Set.notMember`
1396+
effectForks (stepEffect step)
1397+
) threads))
1398+
races
1399+
where
1400+
step = currentStep thread
13961401

13971402
-- | 'updateRaces' turns a current 'Step' into 'StepInfo', and updates all
13981403
-- 'activeRaces'.

0 commit comments

Comments
 (0)