Advertisement
Vultraz

Untitled

Apr 9th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1.     std::mutex surf_lock;
  2.  
  3.     // Load all the images.
  4.     for(const auto& f : file_paths) {
  5.         std::thread([&surf_lock, &surfs](const std::string path) {
  6.             surf_lock.lock();
  7.  
  8.             surface temp = image::get_image(path);
  9.             if(!temp.null()) {
  10.                 surfs.push_back({ std::move(temp), path});
  11.             }
  12.  
  13.             surf_lock.unlock();
  14.         }, f);
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement