'Test synchronization of calls made with C{method}, which should be
one of the mechanisms of the threadpool to execute work in threads.'

def _threadpoolTest(self, method):

    N = 10
    tp = threadpool.ThreadPool()
    tp.start()
    self.addCleanup(tp.stop)
    waiting = threading.Lock()
    waiting.acquire()
    actor = Synchronization(N, waiting)
    for i in range(N):
        method(tp, actor)
    self._waitForLock(waiting)
    self.assertFalse(actor.failures, ('run()    re-entered    %d    times' % (actor.failures,)))
