@@ -849,13 +849,15 @@ deschedule Interruptable thread@Thread {
849
849
}
850
850
simstate@ SimState { curTime = time, threads } = do
851
851
852
- -- We're unmasking, but there are pending blocked async exceptions.
853
- -- So immediately raise the exception and unblock the blocked thread
854
- -- if possible.
855
- let thread' = thread { threadControl = ThreadControl (Throw e) ctl
852
+ let effect' = effect <> wakeupEffects unblocked
853
+ -- We're unmasking, but there are pending blocked async exceptions.
854
+ -- So immediately raise the exception and unblock the blocked thread
855
+ -- if possible.
856
+ thread' = thread { threadControl = ThreadControl (Throw e) ctl
856
857
, threadMasking = MaskedInterruptible
857
858
, threadThrowTo = etids
858
859
, threadVClock = vClock `leastUpperBoundVClock` vClock'
860
+ , threadEffect = effect'
859
861
}
860
862
(unblocked,
861
863
simstate') = unblockThreads False vClock [l_labelled tid'] simstate
@@ -916,23 +918,25 @@ deschedule (Blocked blockedReason) thread@Thread{ threadId = tid,
916
918
races = races',
917
919
control = advanceControl (threadStepId thread1) control }
918
920
919
- deschedule Terminated thread@ Thread { threadId = tid, threadLabel = tlbl, threadVClock = vClock, threadEffect = effect }
921
+ deschedule Terminated thread@ Thread { threadId = tid, threadStep = tstep, threadLabel = tlbl,
922
+ threadVClock = vClock, threadEffect = effect }
920
923
simstate@ SimState { curTime = time, control } = do
921
924
-- This thread is done. If there are other threads blocked in a
922
925
-- ThrowTo targeted at this thread then we can wake them up now.
923
- let thread1 = thread
924
- (thread', eff) = stepThread $ thread { threadStatus = ThreadDone }
925
- wakeup = map (\ (_,tid',_) -> l_labelled tid') (reverse (threadThrowTo thread))
926
+ let wakeup = map (\ (_,tid',_) -> l_labelled tid') (reverse (threadThrowTo thread))
926
927
(unblocked,
927
928
simstate'@ SimState {threads}) =
928
929
unblockThreads False vClock wakeup simstate
929
- threads' = Map. insert tid thread' threads
930
- races' = threadTerminatesRaces tid $ updateRaces thread1 simstate
930
+ effect' = effect <> wakeupEffects unblocked
931
+ (thread', eff) = stepThread $ thread { threadStatus = ThreadDone ,
932
+ threadEffect = effect' }
933
+ threads' = Map. insert tid thread' threads
934
+ races' = threadTerminatesRaces tid $ updateRaces thread { threadEffect = effect' } simstate
931
935
-- We must keep terminated threads in the state to preserve their vector clocks,
932
936
-- which matters when other threads throwTo them.
933
- ! trace <- reschedule simstate' { races = races',
934
- control = advanceControl (threadStepId thread) control,
935
- threads = threads' }
937
+ ! trace <- reschedule simstate' { races = races',
938
+ control = advanceControl (threadStepId thread) control,
939
+ threads = threads' }
936
940
return $ traceMany
937
941
-- TODO: step
938
942
[ (time, tid', (- 1 ), tlbl', EventThrowToWakeup )
0 commit comments