实现简单定时器

This commit is contained in:
2024-01-23 16:27:37 +08:00
parent 5097161b53
commit ca23184273
4 changed files with 234 additions and 2 deletions

View File

@@ -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;
}