Log OpenMP thread ID
Fix OpenMP locks

std::mutex may or may not work with OpenMP.
Use OpenMP specified locks.

Besides, gate OpenMP using _OPENMP macro.