'Check that threads are reaped when too old.'

def testThreadsReaped(self):

    self.now = 0
    with utils.MultiStubber((time, 'time', (lambda : self.now)), (threading, '_time', (lambda : self.now)), (Queue, '_time', (lambda : self.now)), (self.test_pool, 'CPUUsage', (lambda : 0))):
        done_event = threading.Event()
        res = []
        def Block(done, count):
            done.wait()
            res.append(count)
        for i in range((2 * self.MAXIMUM_THREADS)):
            self.test_pool.AddTask(Block, (done_event, i), 'Blocking', inline=False)
        self.assertEqual(len(self.test_pool), self.MAXIMUM_THREADS)
        done_event.set()
        self.now = 1000
        self.WaitUntil((lambda : (len(self.test_pool) == self.NUMBER_OF_THREADS)))
        self.assertEqual(len(self.test_pool), self.NUMBER_OF_THREADS)
