diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-03-09 09:58:31 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-03-09 09:58:31 +0000 |
commit | f8a01fb39f3756bec409c9b752fd4f8088e130bf (patch) | |
tree | 1ee0f7cda4ace7da1756129fe700304cae70ed3d /rts/Capability.c | |
parent | 594eb9175eade48b7d3703502492e57938bb8668 (diff) | |
download | haskell-f8a01fb39f3756bec409c9b752fd4f8088e130bf.tar.gz |
Fix a rare deadlock when the IO manager thread is slow to start up
This fixes occasional failures of ffi002(threaded1) on a loaded
machine.
Diffstat (limited to 'rts/Capability.c')
-rw-r--r-- | rts/Capability.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index c37ec4e0ad..cf85372ce0 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -786,10 +786,18 @@ shutdownCapability (Capability *cap, Task *task, rtsBool safe) "thread(s) are involved in foreign calls, yielding"); cap->running_task = NULL; RELEASE_LOCK(&cap->lock); + // The IO manager thread might have been slow to start up, + // so the first attempt to kill it might not have + // succeeded. Just in case, try again - the kill message + // will only be sent once. + // + // To reproduce this deadlock: run ffi002(threaded1) + // repeatedly on a loaded machine. + ioManagerDie(); yieldThread(); continue; } - + traceEventShutdown(cap); RELEASE_LOCK(&cap->lock); break; |