| 26 | } |
| 27 | |
| 28 | int main() { |
| 29 | const int totalNumbers = 1000000; |
| 30 | const int threadCount = 8; |
| 31 | const int numbersPerThread = totalNumbers / threadCount; |
| 32 | |
| 33 | std::vector<std::thread> threads; |
| 34 | |
| 35 | for (int i = 0; i < threadCount; ++i) { |
| 36 | int start = i * numbersPerThread + 1; |
| 37 | int end = (i == threadCount - 1) ? totalNumbers : (i + 1) * numbersPerThread; |
| 38 | threads.emplace_back(countPrimesInRange, start, end); |
| 39 | } |
| 40 | |
| 41 | for (auto& thread : threads) { |
| 42 | thread.join(); |
| 43 | } |
| 44 | |
| 45 | std::cout << "Total primes found: " << primeCount << std::endl; |
| 46 | |
| 47 | ctrack::result_print(); |
| 48 | |
| 49 | return 0; |
| 50 | } |
nothing calls this directly
no test coverage detected