Skip to content

Commit

Permalink
ensure we don't create too many threads
Browse files Browse the repository at this point in the history
part of #516
  • Loading branch information
stefankueng committed Nov 3, 2024
1 parent 973ed13 commit 6219269
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SearchDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,10 @@ DWORD CSearchDlg::SearchThread()
// use 2 threads less than processors are available,
// because we already have two threads in use:
// the UI thread and this one.
ThreadPool tp(max(std::thread::hardware_concurrency() - 2, 1));
auto hardwareConcurrency = std::thread::hardware_concurrency();
if (hardwareConcurrency < 2)
hardwareConcurrency = 2;
ThreadPool tp(max(hardwareConcurrency - 2, 1));

bool bCountingOnly = m_searchString.empty();

Expand Down

0 comments on commit 6219269

Please sign in to comment.