X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FThreads.c;h=f824d021d47acf6683f56c7cd0bd5ffbbd692640;hp=4f9560c36c10f5ec12163ad8af9dd9d7edafedd6;hb=7408b39235bccdcde48df2a73337ff976fbc09b7;hpb=c0279be6f63e5a46a03d4e84f4368161b93fd8a8 diff --git a/rts/Threads.c b/rts/Threads.c index 4f9560c..f824d02 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -74,7 +74,7 @@ createThread(Capability *cap, nat size) tso->what_next = ThreadRunGHC; tso->why_blocked = NotBlocked; - tso->blocked_exceptions = END_TSO_QUEUE; + tso->blocked_exceptions = END_BLOCKED_EXCEPTIONS_QUEUE; tso->flags = 0; tso->dirty = 1; @@ -218,8 +218,9 @@ unblockOne_ (Capability *cap, StgTSO *tso, // NO, might be a WHITEHOLE: ASSERT(get_itbl(tso)->type == TSO); ASSERT(tso->why_blocked != NotBlocked); + ASSERT(tso->why_blocked != BlockedOnMsgWakeup || + tso->block_info.closure->header.info == &stg_IND_info); - tso->why_blocked = NotBlocked; next = tso->_link; tso->_link = END_TSO_QUEUE; @@ -230,11 +231,13 @@ unblockOne_ (Capability *cap, StgTSO *tso, // We are waking up this thread on the current Capability, which // might involve migrating it from the Capability it was last on. if (tso->bound) { - ASSERT(tso->bound->cap == tso->cap); - tso->bound->cap = cap; + ASSERT(tso->bound->task->cap == tso->cap); + tso->bound->task->cap = cap; } tso->cap = cap; + write_barrier(); + tso->why_blocked = NotBlocked; appendToRunQueue(cap,tso); // context-switch soonish so we can migrate the new thread if @@ -246,6 +249,7 @@ unblockOne_ (Capability *cap, StgTSO *tso, wakeupThreadOnCapability(cap, tso->cap, tso); } #else + tso->why_blocked = NotBlocked; appendToRunQueue(cap,tso); // context-switch soonish so we can migrate the new thread if @@ -327,13 +331,15 @@ printThreadBlockage(StgTSO *tso) case BlockedOnMVar: debugBelch("is blocked on an MVar @ %p", tso->block_info.closure); break; - case BlockedOnException: - debugBelch("is blocked on delivering an exception to thread %lu", - (unsigned long)tso->block_info.tso->id); - break; case BlockedOnBlackHole: debugBelch("is blocked on a black hole"); break; + case BlockedOnMsgWakeup: + debugBelch("is blocked on a wakeup message"); + break; + case BlockedOnMsgThrowTo: + debugBelch("is blocked on a throwto message"); + break; case NotBlocked: debugBelch("is not blocked"); break;