Common mistakes

Race condition

int nthreads;
#pragma omp parallel shared(nthreads)
{
nthreads = omp_get_num_threads();
}

Deadlock

#pragma omp parallel
{
...
#pragma omp critical
{
...
#pragma omp barrier
}
}