Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <functional>
- #include <windows.h>
- class PseudoTimer
- {
- public:
- struct started {};
- struct expierd {};
- void connect(const started&, const std::function<void(void)> &slot) {
- started_ = slot;
- }
- void connect(const expierd&, const std::function<void(int)> &slot) {
- expierd_ = slot;
- }
- void start() {
- started_();
- while (1) {
- static int n = 0;
- Sleep(200);
- expierd_(n++);
- }
- }
- private:
- std::function<void(void)> started_;
- std::function<void(int)> expierd_;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement