当前位置: 首页>>代码示例>>Python>>正文


Python IonProcessThread._interrupt_control_thread方法代码示例

本文整理汇总了Python中pyon.ion.process.IonProcessThread._interrupt_control_thread方法的典型用法代码示例。如果您正苦于以下问题:Python IonProcessThread._interrupt_control_thread方法的具体用法?Python IonProcessThread._interrupt_control_thread怎么用?Python IonProcessThread._interrupt_control_thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyon.ion.process.IonProcessThread的用法示例。


在下文中一共展示了IonProcessThread._interrupt_control_thread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test__interrupt_control_thread

# 需要导入模块: from pyon.ion.process import IonProcessThread [as 别名]
# 或者: from pyon.ion.process.IonProcessThread import _interrupt_control_thread [as 别名]
    def test__interrupt_control_thread(self):
        svc = self._make_service()
        p = IonProcessThread(name=sentinel.name, listeners=[], service=svc)
        p.start()
        p.get_ready_event().wait(timeout=5)
        self.addCleanup(p.stop)

        # put a call in that will never finish
        waitar = AsyncResult()      # test specific, wait for this to indicate we're being processed/hung
        callar = AsyncResult()      # test specific, an ar that is just waited on by the spin call
        def spin(inar, outar):
            outar.set(True)
            inar.wait()

        ar = p._routing_call(spin, MagicMock(), callar, waitar)

        # wait until we get notice we're being processed
        waitar.get(timeout=2)

        # interrupt it
        p._interrupt_control_thread()

        # the ar we got back from routing_call will not be set, it never finished the call
        self.assertFalse(ar.ready())

        # to prove we're unblocked, run another call through the control thread
        ar2 = p._routing_call(callar.set, MagicMock(), sentinel.val)
        ar2.get(timeout=2)
        self.assertTrue(callar.ready())
        self.assertEquals(callar.get(), sentinel.val)
开发者ID:mkl-,项目名称:scioncc,代码行数:32,代码来源:test_process.py


注:本文中的pyon.ion.process.IonProcessThread._interrupt_control_thread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。