Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol committed Jul 21, 2023
1 parent ea54d01 commit 25b1234
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/util/waitingcounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ func (r *WaitingCounter) Add(c int32) {
}

// Done decrements the counter.
// If the counter goes bellow zero
// If the counter goes bellow zero a panic will be raised.
func (r *WaitingCounter) Done() {
if nv := (*atomic.Int32)(r).Add(-1); nv < 0 {
panic("negative counter value")
}
}

// Wait blocks waiting for the counter to go to zero or for the timeout to be reached.
// Wait blocks waiting for the counter value to reach zero or for the timeout to be reached.
// Is guaranteed to wait for at least a hundred milliseconds regardless of given duration if the counter is positive value.
func (r *WaitingCounter) Wait(waitFor time.Duration) int {
deadline := time.Now().Add(waitFor)
Expand Down

0 comments on commit 25b1234

Please sign in to comment.