提交 293d7126 编写于 作者: S songzhibin97

Update cmd_Task.go

上级 bf975af6
......@@ -73,17 +73,12 @@ func newT(f func(chan struct{}) error) *T {
//@description: 添加任务
func (t *T) AddTask() {
if len(t.ch) == 1 {
return
}
t.Lock()
defer t.Unlock()
if len(t.ch) == 1 {
select {
case t.ch <- struct{}{}:
default:
// 代表已经有任务了
// 直接丢弃这次任务
return
}
t.ch <- struct{}{}
}
//@author: [songzhibin97](https://github.com/songzhibin97)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册