Commit 95ec750f authored by Simon Marlow's avatar Simon Marlow
Browse files

Maintain Task/Capability invariants in performPendingThrowTos

Fixes an ASSERTION failure with concprog001, -threaded -debug, +RTS -N2
parent 7d7c187b
...@@ -2710,8 +2710,12 @@ performPendingThrowTos (StgTSO *threads) ...@@ -2710,8 +2710,12 @@ performPendingThrowTos (StgTSO *threads)
{ {
StgTSO *tso, *next; StgTSO *tso, *next;
Capability *cap; Capability *cap;
Task *task, *saved_task;;
step *step; step *step;
task = myTask();
cap = task->cap;
for (tso = threads; tso != END_TSO_QUEUE; tso = next) { for (tso = threads; tso != END_TSO_QUEUE; tso = next) {
next = tso->global_link; next = tso->global_link;
...@@ -2721,7 +2725,17 @@ performPendingThrowTos (StgTSO *threads) ...@@ -2721,7 +2725,17 @@ performPendingThrowTos (StgTSO *threads)
debugTrace(DEBUG_sched, "performing blocked throwTo to thread %lu", (unsigned long)tso->id); debugTrace(DEBUG_sched, "performing blocked throwTo to thread %lu", (unsigned long)tso->id);
cap = tso->cap; // We must pretend this Capability belongs to the current Task
maybePerformBlockedException(cap, tso); // for the time being, as invariants will be broken otherwise.
} // In fact the current Task has exclusive access to the systme
// at this point, so this is just bookkeeping:
task->cap = tso->cap;
saved_task = tso->cap->running_task;
tso->cap->running_task = task;
maybePerformBlockedException(tso->cap, tso);
tso->cap->running_task = saved_task;
}
// Restore our original Capability:
task->cap = cap;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment