X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FSchedule.h;h=45aa0007584088a531784f27027d3685349538cf;hb=6867d7a5ba5bdde3f6216d932d9486405c9115b3;hp=89ac1125faa0cbdc56489cc01b7029d661eb0c80;hpb=200c73fdfea734765c48309cc8dcbcf44b69c8c5;p=ghc-hetmet.git diff --git a/rts/Schedule.h b/rts/Schedule.h index 89ac112..45aa000 100644 --- a/rts/Schedule.h +++ b/rts/Schedule.h @@ -154,6 +154,7 @@ void interruptStgRts (void); nat run_queue_len (void); void resurrectThreads (StgTSO *); +void performPendingThrowTos (StgTSO *); void printAllThreads(void); @@ -236,16 +237,21 @@ appendToBlockedQueue(StgTSO *tso) #endif #if defined(THREADED_RTS) +// Assumes: my_cap is owned by the current Task. We hold +// other_cap->lock, but we do not necessarily own other_cap; another +// Task may be running on it. INLINE_HEADER void -appendToWakeupQueue (Capability *cap, StgTSO *tso) +appendToWakeupQueue (Capability *my_cap, Capability *other_cap, StgTSO *tso) { ASSERT(tso->_link == END_TSO_QUEUE); - if (cap->wakeup_queue_hd == END_TSO_QUEUE) { - cap->wakeup_queue_hd = tso; + if (other_cap->wakeup_queue_hd == END_TSO_QUEUE) { + other_cap->wakeup_queue_hd = tso; } else { - setTSOLink(cap, cap->wakeup_queue_tl, tso); + // my_cap is passed to setTSOLink() because it may need to + // write to the mutable list. + setTSOLink(my_cap, other_cap->wakeup_queue_tl, tso); } - cap->wakeup_queue_tl = tso; + other_cap->wakeup_queue_tl = tso; } #endif