Advertisement
Guest User

Untitled

a guest
Sep 29th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <future>
  2. #include <iostream>
  3. #include <atomic>
  4. int main() {
  5. std::atomic<int> i(0);
  6. for(int j = 0; j < 10; j++) {
  7. std::async([&] {
  8. i = i + 1;
  9. });
  10. }
  11. std::cout << i;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement