Skip to content

Commit

Permalink
Merge pull request #308 from kinke/fix_j
Browse files Browse the repository at this point in the history
Fix -j behavior
  • Loading branch information
atilaneves authored Jan 23, 2024
2 parents 6bc35df + 7979360 commit b362027
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion subpackages/runner/source/unit_threaded/runner/options.d
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct Options {
numThreads = 1; // let -s override -j

if (numThreads == 0)
numThreads = totalCPUs - 1;
numThreads = totalCPUs;

exit = help || list;
}
Expand Down
4 changes: 2 additions & 2 deletions subpackages/runner/source/unit_threaded/runner/testsuite.d
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ private:

_stopWatch.start();

if (_options.numThreads != 1) {
if (_options.numThreads > 1) {
// use a dedicated task pool with non-daemon worker threads
auto taskPool = new TaskPool(_options.numThreads);
auto taskPool = new TaskPool(_options.numThreads - 1); // main thread is used too
_failures = reduce!((a, b) => a ~ b)(_failures, taskPool.amap!runTest(tests));
taskPool.finish(/*blocking=*/false);
} else {
Expand Down

0 comments on commit b362027

Please sign in to comment.