Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

34 lignes
705 B

  1. #pragma once
  2. #include <asyncpp.h>
  3. struct test_delay final
  4. : public asyncpp::base_future<int&, test_delay>
  5. {
  6. public:
  7. using value_type = int&;
  8. using this_type = test_delay;
  9. using base_future_type = base_future<value_type, this_type>;
  10. using result_type = typename base_future_type::result_type;
  11. public:
  12. int const _delay { 5 };
  13. int _count { 0 };
  14. public:
  15. test_delay(int p_delay, int p_count)
  16. : _delay(p_delay)
  17. , _count(p_count)
  18. { }
  19. inline result_type poll()
  20. {
  21. if (_count >= _delay)
  22. return result_type::ready(_count);
  23. ++_count;
  24. return result_type::not_ready();
  25. }
  26. };