实现简单定时器
This commit is contained in:
18
main.cpp
18
main.cpp
@@ -1,6 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <Timer.h>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
{
|
||||
ling::Timer timer([]() {
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
});
|
||||
timer.start(5);
|
||||
getchar();
|
||||
std::cout << "停止" << std::endl;
|
||||
timer.stop();
|
||||
getchar();
|
||||
std::cout << "重新启动" << std::endl;
|
||||
timer.start();
|
||||
getchar();
|
||||
}
|
||||
std::cout << "释放" << std::endl;
|
||||
getchar();
|
||||
ling::Timer::stopAll();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user