🚀 v0.9.1
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)
🛠️ Changes
- Added exception handling during task execution
- Timer will automatically stop if an exception is thrown from the task
- Updated method comments to English for better readability
- Refined and expanded the README documentation
🚀 v0.9.1
SimpleTimer 是一个跨平台、轻量级、线程安全的定时器类,适用于需要定期执行任务的场景。本版本为首个公开发布版本,具备以下核心功能:
✨ 功能概述
- 支持定时执行任务,支持单次(one-shot)和周期性执行模式
- 提供暂停、恢复、重启定时器的能力
- 支持动态修改时间间隔
- 使用
std::thread和std::condition_variable实现,线程安全 - 使用
std::chrono::duration表示间隔时间,支持任意时间单位 - 定时器在析构时自动停止,确保资源安全释放
- 完全基于 C++11,无需第三方库(POSIX 下需链接 pthread)
🛠️ 变化
- 添加执行task时的异常捕获
- 如果在task执行后发送异常, 将停止timer的执行
- 方法注释使用英文
- 更新README