Kenji's OMP nqueens adapted for pthreads