Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1.  
  2. #include <hpx/hpx.hpp>
  3. #include <hpx/hpx_init.hpp>
  4. #include <hpx/include/future.hpp>
  5. #include <hpx/include/hpxr.hpp>
  6. #include <hpx/include/util.hpp>
  7.  
  8. #include <atomic>
  9. #include <iostream>
  10. #include <stdexcept>
  11.  
  12. int x = 0;
  13.  
  14. int deep_thought(int& a)
  15. {
  16.     if(x == 4)
  17.         return a;
  18.  
  19.     a++;
  20.     x++;
  21.     throw std::exception();
  22. }
  23.  
  24. int hpx_main(boost::program_options::variables_map& vm)
  25. {
  26.     int x = 5;
  27.     auto f = hpxr::async_replay(5, deep_thought, std::ref(x));
  28.  
  29.     std::cout << f.get() << std::endl;
  30.  
  31.     return hpx::finalize();
  32. }
  33.  
  34. int main(int argc, char* argv[])
  35. {
  36.  
  37.     return hpx::init();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement