goProject/trunk/goutil/coroutine-timer/readme.md
皮蛋13361098506 1b77f62820 初始化项目
2025-01-06 16:01:02 +08:00

21 lines
600 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

coroutine-timer支持如下工作
定时触发设定的回调,最小精度秒级
## 使用方式
### 增加回调
> 1. 导入包
> 2. 调用AddTimerx添加定时回调传入相关参数
ps:
> 1. AddTimer1AddTimer2AddTimer3是内部自动生成的id内部保证唯一性。外部如果后续要删除该添加的timer需要持有返回的id信息
> 2. AddTimer4 需要外部传入id外部需要保证id的唯一性。并且这个方法会在内部校验id是否已经存在所以性能上会比其他AddTimer方法慢
### 删除回调
```go
DeleteTimer(id)
```