'As C{test_threadCreationArguments} above, but for
callInThreadWithCallback.'

def test_threadCreationArgumentsCallInThreadWithCallback(self):

    tp = threadpool.ThreadPool(0, 1)
    tp.start()
    self.addCleanup(tp.stop)
    self.assertEqual(tp.threads, [])
    refdict = {}
    onResultWait = threading.Event()
    onResultDone = threading.Event()
    resultRef = []
    def onResult(success, result):
        onResultWait.wait(self.getTimeout())
        refdict['workerRef'] = workerRef()
        refdict['uniqueRef'] = uniqueRef()
        onResultDone.set()
        resultRef.append(weakref.ref(result))
    def worker(arg, test):
        return Dumb()
    class Dumb(object, ):
        pass
    unique = Dumb()
    onResultRef = weakref.ref(onResult)
    workerRef = weakref.ref(worker)
    uniqueRef = weakref.ref(unique)
    tp.callInThreadWithCallback(onResult, worker, unique, test=unique)
    del worker
    del unique
    onResultWait.set()
    onResultDone.wait(self.getTimeout())
    gc.collect()
    self.assertIsNone(uniqueRef())
    self.assertIsNone(workerRef())
    del onResult
    gc.collect()
    self.assertIsNone(onResultRef())
    self.assertIsNone(resultRef[0]())
