Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--- ------------------------------------------------------------------------
- void test(size_t current, size_t end)
- {
- //Some code here
- }
- void checkDistance()
- {
- auto numThreads = 2; //std::thread::hardware_concurrency();
- std::vector<std::thread> threads;
- auto blockSize = 1;
- cout<<"numThreads="<<numThreads <<"blockSize="<<blockSize<<"n";
- for(size_t i = 0; i < numThreads - 1; ++i)
- threads.emplace_back(test, i * blockSize, (i+1) * blockSize);
- test((numThreads-1) * blockSize, 5);
- for(auto& thread : threads)
- thread.join();
- }
- int main(int argc, char** argv) {
- checkDistance();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement