def run(self, function, *args, **kwargs):
"""Run C{function} in a thread.
C{function} is run in a thread within a transaction wrapper, which
commits the transaction if C{function} succeeds. If it raises an
exception the transaction is aborted.
@param function: The function to run.
@param args: Positional arguments to pass to C{function}.
@param kwargs: Keyword arguments to pass to C{function}.
@return: A C{Deferred} that will fire after the function has been run.
"""
return deferToThreadPool(reactor, self._threadPool, self._transact,
function, *args, **kwargs)
评论列表
文章目录