MCPcopy Create free account
hub / github.com/goinaction/code / Pool

Struct Pool

chapter7/patterns/pool/pool.go:15–20  ·  view source on GitHub ↗

Pool manages a set of resources that can be shared safely by multiple goroutines. The resource being managed must implement the io.Closer interface.

Source from the content-addressed store, hash-verified

13// multiple goroutines. The resource being managed must implement
14// the io.Closer interface.
15type Pool struct {
16 m sync.Mutex
17 resources chan io.Closer
18 factory func() (io.Closer, error)
19 closed bool
20}
21
22// ErrPoolClosed is returned when an Acquire returns on a
23// closed pool.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected