From: Simon Marlow Date: Fri, 25 Aug 2006 10:02:44 +0000 (+0000) Subject: shutdownCapability(): don't bail out after 50 iterations X-Git-Tag: Before_FC_branch_merge~128 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ac548e9fd9014cc372dcab31eb4c0392ee80ed4e shutdownCapability(): don't bail out after 50 iterations See comments for details. Fixes assertion failures in stage 3 build which appeared after recent closeMutex() addidion. May fix other shutdown issues. --- diff --git a/rts/Capability.c b/rts/Capability.c index e384e1e..7fc1c57 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -646,7 +646,13 @@ shutdownCapability (Capability *cap, Task *task) task->cap = cap; - for (i = 0; i < 50; i++) { + // Loop indefinitely until all the workers have exited and there + // are no Haskell threads left. We used to bail out after 50 + // iterations of this loop, but that occasionally left a worker + // running which caused problems later (the closeMutex() below + // isn't safe, for one thing). + + for (i = 0; /* i < 50 */; i++) { debugTrace(DEBUG_sched, "shutting down capability %d, attempt %d", cap->no, i); ACQUIRE_LOCK(&cap->lock);