Skip to content

Commit 60fad8b

Browse files
author
gbbr
committed
Placed bool read in sync
1 parent c86c2eb commit 60fad8b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎chapter7/patterns/pool/pool.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ func (p *pool) Release(r Resource) {
9898

9999
// Close will shutdown the pool and close all existing resources.
100100
func (p *pool) Close() {
101-
if p.closed {
102-
return
103-
}
104-
105101
// Secure this operation with the Release operation.
106102
p.Lock()
107103
defer p.Unlock()
108104

105+
if p.closed {
106+
return
107+
}
108+
109109
// Close the resources
110110
for r := range p.resources {
111111
r.Close()

0 commit comments

Comments
 (0)