Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
docs: add warning about StopTimer()
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Mar 3, 2020
1 parent 314ac7d commit 7205ffa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/timer/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"time"
)

// Stop the timer and drain the channel.
// Note that this should only be called if the channel hasn't already been
// drained or it may block indefinitely.
func StopTimer(t *time.Timer) {
if !t.Stop() {
// Need to drain the timer if Stop() returns false
Expand Down

0 comments on commit 7205ffa

Please sign in to comment.