Skip to content

Commit 4b3965b

Browse files
Fixed dropsim threads bug.
1 parent 4eec358 commit 4b3965b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

dropsim.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ int main(int argc, char* argv[]) {
538538
thread_count = 1; // Fallback to 1 if hardware_concurrency cannot determine.
539539
}
540540
else {
541-
thread_count -= 2; // Leave 2 cores free to avoid system overload
542541
if (thread_count < 1) {
543542
thread_count = 1; // Ensure at least one thread is used
544543
}
@@ -581,13 +580,13 @@ int main(int argc, char* argv[]) {
581580
threadStorage[i].totalsims++;
582581

583582
// Check if all items have at least mindropcount drops, and if so, break the loop to finish this thread's execution.
584-
if (threadStorage[i].totalsims > 100000 && threadStorage[i].totalsims % 1000 == 0) {
583+
if (threadStorage[i].totalsims >= 100000 && threadStorage[i].totalsims % 1000 == 0) {
585584
allAboveMin = true;
586585

587586
for (const auto& drop : threadStorage[i].totaldrops) {
588587
long dropsLeft = mindropcount - drop.second;
589588

590-
if (dropsLeft > 0 && drop.second > 0) {
589+
if (dropsLeft > 0 && drop.second > 0 || drop.second == 0 && threadStorage[i].totalsims < 1000000) {
591590
allAboveMin = false;
592591
break;
593592
}

0 commit comments

Comments
 (0)