Commit e1e8149d authored by wolfgang.thaller@gmx.net's avatar wolfgang.thaller@gmx.net
Browse files

SMP bugfix: reload capability from task->cap after scheduleDoGC

parent 24ee1592
...@@ -445,6 +445,9 @@ schedule (Capability *initialCapability, Task *task) ...@@ -445,6 +445,9 @@ schedule (Capability *initialCapability, Task *task)
scheduleCheckBlockedThreads(cap); scheduleCheckBlockedThreads(cap);
scheduleDetectDeadlock(cap,task); scheduleDetectDeadlock(cap,task);
#if defined(THREADED_RTS)
cap = task->cap; // reload cap, it might have changed
#endif
// Normally, the only way we can get here with no threads to // Normally, the only way we can get here with no threads to
// run is if a keyboard interrupt received during // run is if a keyboard interrupt received during
...@@ -678,7 +681,12 @@ run_thread: ...@@ -678,7 +681,12 @@ run_thread:
} }
if (scheduleDoHeapProfile(ready_to_gc)) { ready_to_gc = rtsFalse; } if (scheduleDoHeapProfile(ready_to_gc)) { ready_to_gc = rtsFalse; }
if (ready_to_gc) { scheduleDoGC(cap,task,rtsFalse,GetRoots); } if (ready_to_gc) {
scheduleDoGC(cap,task,rtsFalse,GetRoots);
#if defined(THREADED_RTS)
cap = task->cap; // reload cap, it might have changed
#endif
}
} /* end of while() */ } /* end of while() */
IF_PAR_DEBUG(verbose, IF_PAR_DEBUG(verbose,
...@@ -915,6 +923,10 @@ scheduleDetectDeadlock (Capability *cap, Task *task) ...@@ -915,6 +923,10 @@ scheduleDetectDeadlock (Capability *cap, Task *task)
// exception. Any threads thus released will be immediately // exception. Any threads thus released will be immediately
// runnable. // runnable.
scheduleDoGC( cap, task, rtsTrue/*force major GC*/, GetRoots ); scheduleDoGC( cap, task, rtsTrue/*force major GC*/, GetRoots );
#if defined(THREADED_RTS)
cap = task->cap; // reload cap, it might have changed
#endif
recent_activity = ACTIVITY_DONE_GC; recent_activity = ACTIVITY_DONE_GC;
if ( !emptyRunQueue(cap) ) return; if ( !emptyRunQueue(cap) ) return;
...@@ -1899,7 +1911,7 @@ scheduleDoGC (Capability *cap, Task *task USED_IF_THREADS, ...@@ -1899,7 +1911,7 @@ scheduleDoGC (Capability *cap, Task *task USED_IF_THREADS,
IF_DEBUG(scheduler, sched_belch("someone else is trying to GC...")); IF_DEBUG(scheduler, sched_belch("someone else is trying to GC..."));
if (cap) yieldCapability(&cap,task); if (cap) yieldCapability(&cap,task);
} while (waiting_for_gc); } while (waiting_for_gc);
return; return; // NOTE: task->cap might have changed here
} }
for (i=0; i < n_capabilities; i++) { for (i=0; i < n_capabilities; i++) {
......
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