summaryrefslogtreecommitdiff
path: root/rts/RaiseAsync.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-03-11 12:37:05 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-03-11 12:37:05 +0000
commit1e31c2960f7a9fc61119237d8a35b0516d6accca (patch)
tree0de5f1c0653b06a69a2c0c4208b43ab00632e840 /rts/RaiseAsync.c
parent7408b39235bccdcde48df2a73337ff976fbc09b7 (diff)
downloadhaskell-1e31c2960f7a9fc61119237d8a35b0516d6accca.tar.gz
Fix a couple of bugs in the throwTo handling, exposed by conc016(threaded2)
Diffstat (limited to 'rts/RaiseAsync.c')
-rw-r--r--rts/RaiseAsync.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index d54f823d6e..d02a2567ff 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -70,6 +70,9 @@ throwToSingleThreaded_(Capability *cap, StgTSO *tso, StgClosure *exception,
if (tso->what_next == ThreadComplete || tso->what_next == ThreadKilled) {
return;
}
+ while (tso->what_next == ThreadRelocated) {
+ tso = tso->_link;
+ }
// Remove it from any blocking queues
removeFromQueues(cap,tso);
@@ -84,6 +87,9 @@ suspendComputation(Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here)
if (tso->what_next == ThreadComplete || tso->what_next == ThreadKilled) {
return;
}
+ while (tso->what_next == ThreadRelocated) {
+ tso = tso->_link;
+ }
// Remove it from any blocking queues
removeFromQueues(cap,tso);
@@ -772,20 +778,17 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
fprintCCS_stderr(tso->prof.CCCS);
}
#endif
-
- while (tso->what_next == ThreadRelocated) {
- tso = tso->_link;
- }
+ // ASSUMES: the thread is not already complete or dead, or
+ // ThreadRelocated. Upper layers should deal with that.
+ ASSERT(tso->what_next != ThreadComplete &&
+ tso->what_next != ThreadKilled &&
+ tso->what_next != ThreadRelocated);
// mark it dirty; we're about to change its stack.
dirty_TSO(cap, tso);
sp = tso->sp;
- // ASSUMES: the thread is not already complete or dead. Upper
- // layers should deal with that.
- ASSERT(tso->what_next != ThreadComplete && tso->what_next != ThreadKilled);
-
if (stop_here != NULL) {
updatee = stop_here->updatee;
} else {