MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / WaitTimeout

Method WaitTimeout

lib/sync/wait/wait.go:30–43  ·  view source on GitHub ↗

WaitTimeout waits until the WaitGroup counter is zero or timeout. It returns true if timed out.

(timeout time.Duration)

Source from the content-addressed store, hash-verified

28// WaitTimeout waits until the WaitGroup counter is zero or timeout.
29// It returns true if timed out.
30func (w *Wait) WaitTimeout(timeout time.Duration) bool {
31 c := make(chan bool, 1)
32 go func() {
33 defer close(c)
34 w.wg.Wait()
35 c <- true
36 }()
37 select {
38 case <-c:
39 return false
40 case <-time.After(timeout): // complete normally
41 return true // timed out
42 }
43}

Callers 1

CloseMethod · 0.80

Calls 1

WaitMethod · 0.80

Tested by

no test coverage detected