This commit is contained in:
aozhiwei 2024-06-29 20:49:08 +08:00
parent 5c996e016a
commit 6d58535a91

View File

@ -335,6 +335,20 @@ func AdjustRangeValue[T int | int32 | int64 | float32 | float64](value T, minV T
return value
}
func CreateCondTimer(ch chan int64, cond *sync.Cond) {
var waitSecond int64 = 10
for {
select {
case waitSecond = <-ch:
if waitSecond < 10 {
waitSecond = 10
}
case <-time.After(time.Second * time.Duration(waitSecond)):
cond.Broadcast()
}
}
}
func IsDebug() bool {
return true
}