Skip to content

Commit

Permalink
bugfix: clear wsqueue when return to sched
Browse files Browse the repository at this point in the history
  • Loading branch information
shwestrick committed Oct 2, 2023
1 parent d741bab commit b6e21de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion basis-library/schedulers/hybrid/Scheduler.sml
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,10 @@ struct
val myId = myWorkerId ()
val {queue, ...} = vectorSub (workerLocalData, myId)
in
Queue.clear queue
if Queue.size queue > 0 then
die (fn _ => "scheduler bug: clear on non-empty queue")
else
Queue.clear queue
end

fun popDiscard () =
Expand Down Expand Up @@ -1186,6 +1189,7 @@ struct
;*) Queue.setDepth myQueue depth
; threadSwitch thread
; afterReturnToSched ()
; clear ()
; Queue.setDepth myQueue 1
; acquireWork ()
)
Expand All @@ -1202,6 +1206,7 @@ struct
(* dbgmsg' (fn _ => "switch to new task thread"); *)
threadSwitch taskThread;
afterReturnToSched ();
clear ();
Queue.setDepth myQueue 1;
acquireWork ()
end
Expand Down

0 comments on commit b6e21de

Please sign in to comment.