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)
评论列表
文章目录