本文整理汇总了Python中twisted.internet.selectreactor.SelectReactor.spin_task方法的典型用法代码示例。如果您正苦于以下问题:Python SelectReactor.spin_task方法的具体用法?Python SelectReactor.spin_task怎么用?Python SelectReactor.spin_task使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.selectreactor.SelectReactor
的用法示例。
在下文中一共展示了SelectReactor.spin_task方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SelectReactor
# 需要导入模块: from twisted.internet.selectreactor import SelectReactor [as 别名]
# 或者: from twisted.internet.selectreactor.SelectReactor import spin_task [as 别名]
# for the specific language governing rights and limitations under the
# License.
#
# by Greg Hazel
from twisted.internet import iocpreactor
iocpreactor.proactor.install()
from twisted.internet.selectreactor import SelectReactor
selectreactor = SelectReactor()
from twisted.internet import reactor
selectreactor.spin_task = 0
def selectrun():
selectreactor.iterate(0)
if selectreactor.spin_task > 0:
reactor.callLater(0.01, selectrun)
class HookedFactory(object):
def __init__(self, factory):
self.factory = factory
def startedConnecting(self, connector):
if selectreactor.spin_task == 0:
reactor.callLater(0.01, selectrun)