Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker is a replacement for sync.WaitGroup that properly handles the case when a goroutine attempts to call Add after Wait has been called. For example:
Goroutine A (server shutdown) wg.Wait() // waits for all work to finish
Goroutine B (handling request) - might run AFTER Wait() starts wg.Add(1) // PANIC or undefined behaviour
With Tracker, Add returns false instead and Goroutine B can handle the rejection gracefully.
Inspired by net/http See https://cs.opensource.google/go/go/+/refs/tags/go1.25.1:src/net/http/server.go;l=3604
Click to show internal directories.
Click to hide internal directories.