add main_loop interface