add the all_n for thread build