The BARRIER directive synchronizes all threads in the team.
When a BARRIER directive is reached, a thread will wait at that point until all other threads have reached that barrier. All threads then resume executing in parallel the code that follows the barrier.
!$OMP BARRIER
###C/C++
#pragma omp barrier newline
All threads in a team (or none) must execute the BARRIER region.
The sequence of work-sharing regions and barrier regions encountered must be the same for every thread in a team.