fix golint issues in core/syncx (#526)
This commit is contained in:
@@ -7,17 +7,19 @@ import (
|
||||
"github.com/tal-tech/go-zero/core/timex"
|
||||
)
|
||||
|
||||
// A Cond is used to wait for conditions.
|
||||
type Cond struct {
|
||||
signal chan lang.PlaceholderType
|
||||
}
|
||||
|
||||
// NewCond returns a Cond.
|
||||
func NewCond() *Cond {
|
||||
return &Cond{
|
||||
signal: make(chan lang.PlaceholderType),
|
||||
}
|
||||
}
|
||||
|
||||
// WaitWithTimeout wait for signal return remain wait time or timed out
|
||||
// WaitWithTimeout wait for signal return remain wait time or timed out.
|
||||
func (cond *Cond) WaitWithTimeout(timeout time.Duration) (time.Duration, bool) {
|
||||
timer := time.NewTimer(timeout)
|
||||
defer timer.Stop()
|
||||
@@ -33,7 +35,7 @@ func (cond *Cond) WaitWithTimeout(timeout time.Duration) (time.Duration, bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for signal
|
||||
// Wait waits for signals.
|
||||
func (cond *Cond) Wait() {
|
||||
<-cond.signal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user