Commit 8ec22a59 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix #2663: we had a hard-wired capabilities[0]

For some unknown reason in schedulePostRunThread() we were always
passing capabilities[0] rather than the current Capability to
throwToSingleThreaded().  This caused all kinds of weird failures and
crashes in STM code when running on multiple processors.
parent 8ef97aa3
......@@ -150,7 +150,7 @@ static rtsBool scheduleGetRemoteWork(Capability *cap);
static void scheduleSendPendingMessages(void);
static void scheduleActivateSpark(Capability *cap);
#endif
static void schedulePostRunThread(StgTSO *t);
static void schedulePostRunThread(Capability *cap, StgTSO *t);
static rtsBool scheduleHandleHeapOverflow( Capability *cap, StgTSO *t );
static void scheduleHandleStackOverflow( Capability *cap, Task *task,
StgTSO *t);
......@@ -622,7 +622,7 @@ run_thread:
CCCS = CCS_SYSTEM;
#endif
schedulePostRunThread(t);
schedulePostRunThread(cap,t);
t = threadStackUnderflow(task,t);
......@@ -1064,7 +1064,7 @@ scheduleGetRemoteWork(Capability *cap)
* ------------------------------------------------------------------------- */
static void
schedulePostRunThread (StgTSO *t)
schedulePostRunThread (Capability *cap, StgTSO *t)
{
// We have to be able to catch transactions that are in an
// infinite loop as a result of seeing an inconsistent view of
......@@ -1085,8 +1085,7 @@ schedulePostRunThread (StgTSO *t)
// ATOMICALLY_FRAME, aborting the (nested)
// transaction, and saving the stack of any
// partially-evaluated thunks on the heap.
throwToSingleThreaded_(&capabilities[0], t,
NULL, rtsTrue, NULL);
throwToSingleThreaded_(cap, t, NULL, rtsTrue, NULL);
ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME);
}
......
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