2
0

Closing a closed pool is a no-op

This commit is contained in:
Jack Christensen
2020-04-02 22:10:13 -05:00
parent fc71d04d41
commit 2cd0ce3f9b
+4
View File
@@ -144,6 +144,10 @@ func NewPool(constructor Constructor, destructor Destructor, maxSize int32) *Poo
// Blocks until all resources are returned to pool and destroyed.
func (p *Pool) Close() {
p.cond.L.Lock()
if p.closed {
p.cond.L.Unlock()
return
}
p.closed = true
for _, res := range p.idleResources {