优化rpc超时-使用时间轮定时器

This commit is contained in:
boyce
2020-11-02 14:50:54 +08:00
parent 59c9d20071
commit c98de9b1e9
7 changed files with 34 additions and 41 deletions

View File

@@ -109,6 +109,10 @@ type Timer struct {
//停止停时器
func (timer *Timer) Close(){
timer.bClose = true
if timer.bClose == true {
return
}
//将关闭标志设为1关闭状态
if atomic.SwapInt32(&timer.end,1) == 0 {
chanStopTimer<-timer