Fix unbounded blowup for terminating threads.