-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (31 loc) · 790 Bytes
/
Copy pathmain.cpp
File metadata and controls
40 lines (31 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include "task_timer.h"
void test()
{
std::cout << "Timer thread id: " << std::this_thread::get_id() << std::endl;
}
int main()
{
std::cout << "Main thread id: " << std::this_thread::get_id() << std::endl;
task_timer<> t0;
t0.set_single_shot(true);
t0.bind(test);
t0.start(100);
task_timer<> t;
t.bind(test);
t.bind([]{ std::cout << "Hello C++" << std::endl; });
t.start(1000);
std::cin.get();
t.stop();
std::cout << "Timer stop" << std::endl;
std::cin.get();
t.start();
std::cout << "Timer restart" << std::endl;
std::cin.get();
t0.destroy();
t.destroy();
std::cout << "Timer destroy" << std::endl;
std::cin.get();
std::cout << "Process end" << std::endl;
return 0;
}