Skip to content

Commit 1af1f0c

Browse files
committed
io-sim-por: fixed trace of deschedule calls
Note: `deschedule` is traced by the caller, not by itself.
1 parent 4497edc commit 1af1f0c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,13 @@ deschedule Interruptable thread@Thread {
863863
simstate') = unblockThreads False vClock [l_labelled tid'] simstate
864864
-- the thread is stepped when we Yield
865865
!trace <- deschedule Yield thread' simstate'
866-
return $ SimPORTrace time tid tstep tlbl (EventDeschedule Yield)
867-
$ SimPORTrace time tid tstep tlbl (EventThrowToUnmasked tid')
866+
return $ SimPORTrace time tid tstep tlbl (EventThrowToUnmasked tid')
867+
$ SimPORTrace time tid tstep tlbl (EventEffect vClock effect')
868868
-- TODO: step
869869
$ traceMany [ (time, tid'', (-1), tlbl'', EventThrowToWakeup)
870870
| tid'' <- unblocked
871871
, let tlbl'' = lookupThreadLabel tid'' threads ]
872+
$ SimPORTrace time tid tstep tlbl (EventDeschedule Yield)
872873
trace
873874

874875
deschedule Interruptable thread@Thread{threadId = tid,
@@ -890,15 +891,19 @@ deschedule Interruptable thread@Thread{threadId = tid,
890891
control = advanceControl (threadStepId thread) control }
891892

892893
deschedule (Blocked _blockedReason) thread@Thread { threadId = tid
894+
, threadStep = tstep
895+
, threadLabel = tlbl
893896
, threadThrowTo = _ : _
894897
, threadMasking = maskst
895-
, threadEffect = effect } simstate
898+
, threadEffect = effect }
899+
simstate@SimState{ curTime = time }
896900
| maskst /= MaskedUninterruptible =
897901
-- We're doing a blocking operation, which is an interrupt point even if
898902
-- we have async exceptions masked, and there are pending blocked async
899903
-- exceptions. So immediately raise the exception and unblock the blocked
900904
-- thread if possible.
901-
deschedule Interruptable thread { threadMasking = Unmasked } simstate
905+
SimPORTrace time tid tstep tlbl (EventDeschedule Interruptable) <$>
906+
deschedule Interruptable thread { threadMasking = Unmasked } simstate
902907

903908
deschedule (Blocked blockedReason) thread@Thread{ threadId = tid,
904909
threadStep = tstep,

0 commit comments

Comments
 (0)