Tools/MMapsGenerator: Use system supported threads instead of hardcoded amount

- Use unsigned int for thread count

- Use std::thread::hardware_concurrency() to try estimate available threads instead of hardcoded 3 threads by default

- Print thread count always regardless of using --threads switch or not
This commit is contained in:
Aokromes committed 2017-08-13 03:42:20 +02:00
1 parent 227a4d8ccb
commit 0e6377c90e
3 files changed
+9 -7

No files matched your search

+4 -2
View File
@@ -205,9 +205,11 @@ namespace MMAP
}
}
void MapBuilder::buildAllMaps(int threads)
void MapBuilder::buildAllMaps(unsigned int threads)
{
for (int i = 0; i < threads; ++i)
printf("Using %u threads to extract mmaps\n", threads);
for (unsigned int i = 0; i < threads; ++i)
{
_workerThreads.push_back(std::thread(&MapBuilder::WorkerThread, this));
}