Advertisement
onilink_

Untitled

Jun 28th, 2022
840
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     std::vector<std::thread> workers;
  2.     unsigned threads = std::thread::hardware_concurrency();
  3.     unsigned line_start = 0;
  4.     unsigned line_adv = _size.hei / threads;
  5.     for(unsigned i=0; i<threads; ++i) {
  6.         workers.emplace_back(processBlock, line_start, line_start + line_adv);
  7.         line_start += line_adv;
  8.     }
  9.    
  10.     std::for_each(workers.begin(), workers.end(), [](std::thread &t)  {
  11.         t.join();
  12.     });
Advertisement
RAW Paste Data Copied
Advertisement