OpenMP solution with active waiting