Protect shared memory in OMP model.