listener.py 文件源码

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

项目:nitro 作者: KVM-VMI 项目源码 文件源码
def listen_vcpu(self, vcpu_io, queue):
        """Listen to an individual virtual CPU"""
        logging.info('Start listening on VCPU %s', vcpu_io.vcpu_nb)
        # we need a per thread continue event
        continue_event = threading.Event()
        while not self.stop_request.is_set():
            try:
                nitro_raw_ev = vcpu_io.get_event()
            except ValueError as e:
                if not self.vm_io.syscall_filters:
                    # if there are no filters, get_event should not timeout
                    # since we capture all system calls
                    # so log the error
                    logging.debug(str(e))
            else:
                e = NitroEvent(nitro_raw_ev, vcpu_io)
                # put the event in the queue
                # and wait for the event to be processed,
                # when the main thread will set the continue_event
                item = (e, continue_event)
                queue.put(item)
                continue_event.wait()
                # reset continue_event
                continue_event.clear()
                vcpu_io.continue_vm()

        logging.debug('stop listening on VCPU %s', vcpu_io.vcpu_nb)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号