diff --git a/src/ttables.h b/src/ttables.h index 7dc43b3..f915d61 100644 --- a/src/ttables.h +++ b/src/ttables.h @@ -78,7 +78,9 @@ class TTable { } inline void Increment(const unsigned e, const unsigned f, const double x) { - counts[e].find(f)->second += x; // Ignore race conditions here. +// Each thread locks only the part of the table which is writing on. Other threads have access to the rest of the table to update! +#pragma omp atomic + counts[e].find(f)->second += x;. } void NormalizeVB(const double alpha) {