fix barrier sync hangs during enter or leave functions.