diff --git a/kmc_core/small_sort.h b/kmc_core/small_sort.h index 10215f2..800e295 100644 --- a/kmc_core/small_sort.h +++ b/kmc_core/small_sort.h @@ -153,13 +153,25 @@ class CSmallSort { static void Adjust(uint32 max_small_size = 256) { + static bool is_adjusted = false; + if (is_adjusted) + return; + + static std::mutex mtx; + std::lock_guard lck(mtx); + if (is_adjusted) + return; + PrepareArray(); EvaluateAlgorithms(max_small_size); SmoothTimes(); SelectBestSorters(); ReleaseArray(); + + is_adjusted = true; } + static void Sort(CKmer *ptr, uint32 size) { sorters[size](ptr, size);