Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <functional>
  3. #include <windows.h>
  4.  
  5. class PseudoTimer
  6. {
  7. public:
  8. struct started {};
  9. struct expierd {};
  10.  
  11. void connect(const started&, const std::function<void(void)> &slot) {
  12. started_ = slot;
  13. }
  14. void connect(const expierd&, const std::function<void(int)> &slot) {
  15. expierd_ = slot;
  16. }
  17. void start() {
  18. started_();
  19. while (1) {
  20. static int n = 0;
  21. Sleep(200);
  22. expierd_(n++);
  23. }
  24. }
  25. private:
  26. std::function<void(void)> started_;
  27. std::function<void(int)> expierd_;
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement