aboutsummaryrefslogtreecommitdiffstats
path: root/timer.go
diff options
context:
space:
mode:
Diffstat (limited to 'timer.go')
-rw-r--r--timer.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/timer.go b/timer.go
index f00ca49..6cac40d 100644
--- a/timer.go
+++ b/timer.go
@@ -12,8 +12,7 @@ type Timer struct {
/* Starts the timer if not already pending
*/
func (t *Timer) Start(dur time.Duration) bool {
- set := t.pending.Swap(true)
- if !set {
+ if !t.pending.Swap(true) {
t.timer.Reset(dur)
return true
}
@@ -23,8 +22,7 @@ func (t *Timer) Start(dur time.Duration) bool {
/* Stops the timer
*/
func (t *Timer) Stop() {
- set := t.pending.Swap(true)
- if set {
+ if t.pending.Swap(true) {
t.timer.Stop()
select {
case <-t.timer.C: