summaryrefslogtreecommitdiff
path: root/rts/RaiseAsync.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-12-03 09:48:18 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-12-03 09:48:18 +0000
commite9c6b0de1890a66a9ce2e7749eaf7d7317c9dd01 (patch)
tree68f0fd549757331bab9871c1e36247ac9e017ef9 /rts/RaiseAsync.c
parent3d7ffacd15ac7f44393a2b0186972c8903a1b643 (diff)
downloadhaskell-e9c6b0de1890a66a9ce2e7749eaf7d7317c9dd01.tar.gz
handle ThreadMigrating in throwTo() (#4811)
If a throwTo targets a thread that has just been created with forkOnIO, then it is possible the exception strikes while the thread is still in the process of migrating. throwTo() didn't handle this case, but it's fairly straightforward.
Diffstat (limited to 'rts/RaiseAsync.c')
-rw-r--r--rts/RaiseAsync.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index 628dff8ce8..3cfb4504ae 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -436,6 +436,18 @@ check_target:
}
#endif
+ case ThreadMigrating:
+ // if is is ThreadMigrating and tso->cap is ours, then it
+ // *must* be migrating *to* this capability. If it were
+ // migrating away from the capability, then tso->cap would
+ // point to the destination.
+ //
+ // There is a MSG_WAKEUP in the message queue for this thread,
+ // but we can just do it preemptively:
+ tryWakeupThread(cap, target);
+ // and now retry, the thread should be runnable.
+ goto retry;
+
default:
barf("throwTo: unrecognised why_blocked value");
}