listener.py 文件源码

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

项目:nitro 作者: KVM-VMI 项目源码 文件源码
def stop_listen(self):
        """Stop listening for events"""
        self.set_traps(False)
        self.stop_request.set()
        nb_threads = len([f for f in self.futures if f.running()])
        if nb_threads:
            # ack current thread
            self.current_cont_event.set()
            # wait for current thread to terminate
            while [f for f in self.futures if f.running()] == nb_threads:
                time.sleep(0.1)
            # ack the rest of the threads
            while [f for f in self.futures if f.running()]:
                if self.queue.full():
                    (*rest, continue_event) = self.queue.get()
                    continue_event.set()
                # let the threads terminate
                time.sleep(0.1)
            # wait for threads to exit
            wait(self.futures)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号