def process_http(quit_event, names_queue, status_queue, http_port): """HTTP 进程主函数 Args: quit_event (multiprocessing.Event): 需要退出的事件 names_queue (multiprocessing.Queue): 更新基站名列表的队列 status_queue (multiprocessing.Queue): 更新差分状态的队列 http_port (int): web 服务器端口号 """ if http_port is not None: log.init(PROCESS_NAME) # start http_thread = HttpThread(http_port) if http_port is not None: http_thread.start() # loop try: while not quit_event.is_set(): quit_event.wait(timeout=1) update_names_from_queue(names_queue, lambda rtk_names: RtkStatus.update_names(rtk_names)) update_status_from_queue(status_queue, lambda name_status: RtkStatus.update_status(name_status[0], name_status[1])) except KeyboardInterrupt: pass # quit if http_port is not None: http_thread.shutdown() http_thread.join() log.close(PROCESS_NAME)
def process_main(quit_event, queue_out, name, config): """进程主函数 Args: quit_event (multiprocessing.Event): 需要退出的事件 queue_out (multiprocessing.Queue): 每当收到数据时,将线程名填入此队列 name (str): 线程名 config (Entry): 配置表 """ log.init(name, config.enable_log) base64_log.init(name + '_raw', config.enable_raw) rtk_thread = RtkThread(name, config, lambda status: queue_out.put( (name, status))) rtk_thread.start() while rtk_thread.running: try: if quit_event.wait(timeout=3): # true means event set break except KeyboardInterrupt: pass rtk_thread.running = False rtk_thread.join() log.close(name) base64_log.close(name + '_raw')
def process_main(quit_event, queue_out, name, config): """进程主函数 Args: quit_event (multiprocessing.Event): 需要退出的事件 queue_out (multiprocessing.Queue): 每当收到数据时,将线程名填入此队列 name (str): 线程名 config (dict): 配置表 """ enable_log = config['enableLog'].lower() == 'true' log.init(name, enable_log) rtk_thread = RtkThread(name, config, lambda status: queue_out.put((name, status))) rtk_thread.start() while rtk_thread.running: try: if quit_event.wait(timeout=3): # true means event set break except KeyboardInterrupt: pass rtk_thread.running = False rtk_thread.join() log.close(name)