rename trySend to send

This commit is contained in:
Anton Kaliaev 2017-12-08 11:17:07 -06:00
parent ec4adf21e0
commit ff2fd63bf7
No known key found for this signature in database
GPG Key ID: 7B6881D965918214
1 changed files with 6 additions and 6 deletions

View File

@ -68,20 +68,20 @@ func (t *RepeatTimer) run() {
// don't close channels, as closed channels mess up select reads // don't close channels, as closed channels mess up select reads
done = t.processInput(cmd) done = t.processInput(cmd)
case tick := <-t.ticker.C: case tick := <-t.ticker.C:
t.trySend(tick) t.send(tick)
} }
} }
} }
// trySend performs non-blocking send on t.Ch // send performs blocking send on t.Ch
func (t *RepeatTimer) trySend(tick time.Time) { func (t *RepeatTimer) send(tick time.Time) {
// NOTE: this was blocking in previous version (t.Ch <- t_) // XXX: possibly it is better to not block:
// probably better not: https://golang.org/src/time/sleep.go#L132 // https://golang.org/src/time/sleep.go#L132
t.output <- tick
// select { // select {
// case t.output <- tick: // case t.output <- tick:
// default: // default:
// } // }
t.output <- tick
} }
// all modifications of the internal state of ThrottleTimer // all modifications of the internal state of ThrottleTimer