Skip to content

Commit

Permalink
fix for multiple kmc instances in a single process
Browse files Browse the repository at this point in the history
  • Loading branch information
marekkokot committed Jan 18, 2024
1 parent a2f3560 commit 45d68f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kmc_core/small_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> lck(mtx);
if (is_adjusted)
return;

PrepareArray();
EvaluateAlgorithms(max_small_size);
SmoothTimes();
SelectBestSorters();
ReleaseArray();

is_adjusted = true;
}


static void Sort(CKmer<SIZE> *ptr, uint32 size)
{
sorters[size](ptr, size);
Expand Down

0 comments on commit 45d68f9

Please sign in to comment.