use recursive_mutex to protect State