netpycos.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:pycos 作者: pgiri 项目源码 文件源码
def monitor(self, task, timeout=MsgTimeout):
        """Must be used with 'yeild' as 'reply = yield rti.monitor(task)'.

        Install 'task' (a Task instance) as monitor for tasks created; i.e.,
        'task' receives MonitorException messages. If call is successful, the
        result is 0.
        """
        if not isinstance(task, Task) and monitor is not None:
            raise StopIteration(-1)
        if self._mid:
            mid = self._mid
        else:
            mid = RTI._pycos._location
        req = _NetRequest('rti_monitor', kwargs={'name': self._name, 'monitor': task, 'mid': mid},
                          dst=self._location, timeout=timeout)
        reply = yield _Peer._sync_reply(req)
        if reply == 0:
            self._mid = mid
        raise StopIteration(reply)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号