MCPcopy Create free account
hub / github.com/1Panel-dev/KubePi / newCounter

Function newCounter

thirdparty/gotty/server/handler_atomic.go:16–29  ·  view source on GitHub ↗
(duration time.Duration)

Source from the content-addressed store, hash-verified

14}
15
16func newCounter(duration time.Duration) *counter {
17 zeroTimer := time.NewTimer(duration)
18
19 // when duration is 0, drain the expire event here
20 // so that user will never get the event.
21 if duration == 0 {
22 <-zeroTimer.C
23 }
24
25 return &counter{
26 duration: duration,
27 zeroTimer: zeroTimer,
28 }
29}
30
31func (counter *counter) add(n int) int {
32 counter.mutex.Lock()

Callers 1

RunMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected