removed volatile on critical, changed omp_lock_t to a mutex type, and UA works