'L{ThreadPool.callInThreadWithCallback} calls the function it is
given and the C{onResult} callback in the same thread.'

def test_callbackThread(self):

    threadIds = []
    event = threading.Event()
    def onResult(success, result):
        threadIds.append(threading.currentThread().ident)
        event.set()
    def func():
        threadIds.append(threading.currentThread().ident)
    tp = threadpool.ThreadPool(0, 1)
    tp.callInThreadWithCallback(onResult, func)
    tp.start()
    self.addCleanup(tp.stop)
    event.wait(self.getTimeout())
    self.assertEqual(len(threadIds), 2)
    self.assertEqual(threadIds[0], threadIds[1])
