Repository navigation
v0.9.0
🚀 v0.9.0 - Initial Public Release
SimpleTimer is a cross-platform, lightweight, and thread-safe timer class for executing tasks at regular intervals. This is the first public release with the following features:
✨ Features
- Supports periodic and one-shot task execution
- Timer can be paused, resumed, restarted, and interval modified dynamically
- Built using
std::threadandstd::condition_variable(thread-safe) - Uses
std::chrono::durationfor interval timing, supports any time unit - Automatically stops and cleans up on destruction
- Fully based on C++11 — no third-party libraries required (except pthread on POSIX)
📦 Dependencies
- C++11 standard library
- POSIX systems require linking with
pthread
🧪 Examples
Check the examples folder for more usage scenarios, including using lambda expressions to call parameterized functions periodically.
🚀 v0.9.0 - 初始公开版本
SimpleTimer 是一个跨平台、轻量级、线程安全的定时器类,适用于需要定期执行任务的场景。本版本为首个公开发布版本,具备以下核心功能:
✨ 新功能
- 支持定时执行任务,支持单次(one-shot)和周期性执行模式
- 提供暂停、恢复、重启定时器的能力
- 支持动态修改时间间隔
- 使用
std::thread和std::condition_variable实现,线程安全 - 使用
std::chrono::duration表示间隔时间,支持任意时间单位 - 定时器在析构时自动停止,确保资源安全释放
- 完全基于 C++11,无需第三方库(POSIX 下需链接 pthread)
📦 依赖
- 仅依赖 C++11 标准库
- POSIX 系统需链接
pthread库
🧪 示例
查看 examples 文件夹了解更多使用方式,包括定时调用带参数的函数等高级用法。