Skip to content

Commit 128b4b5

Browse files
authored
Merge pull request #288 from panjf2000/dev
ver: release v2.8.1
2 parents 1411ae8 + 2806c4a commit 128b4b5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

pool.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ func (p *Pool) Release() {
276276
if !atomic.CompareAndSwapInt32(&p.state, OPENED, CLOSED) {
277277
return
278278
}
279+
280+
if p.stopPurge != nil {
281+
p.stopPurge()
282+
p.stopPurge = nil
283+
}
284+
p.stopTicktock()
285+
p.stopTicktock = nil
286+
279287
p.lock.Lock()
280288
p.workers.reset()
281289
p.lock.Unlock()
@@ -289,13 +297,6 @@ func (p *Pool) ReleaseTimeout(timeout time.Duration) error {
289297
if p.IsClosed() || (!p.options.DisablePurge && p.stopPurge == nil) || p.stopTicktock == nil {
290298
return ErrPoolClosed
291299
}
292-
293-
if p.stopPurge != nil {
294-
p.stopPurge()
295-
p.stopPurge = nil
296-
}
297-
p.stopTicktock()
298-
p.stopTicktock = nil
299300
p.Release()
300301

301302
endTime := time.Now().Add(timeout)

pool_func.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ func (p *PoolWithFunc) Release() {
282282
if !atomic.CompareAndSwapInt32(&p.state, OPENED, CLOSED) {
283283
return
284284
}
285+
286+
if p.stopPurge != nil {
287+
p.stopPurge()
288+
p.stopPurge = nil
289+
}
290+
p.stopTicktock()
291+
p.stopTicktock = nil
292+
285293
p.lock.Lock()
286294
p.workers.reset()
287295
p.lock.Unlock()
@@ -295,13 +303,6 @@ func (p *PoolWithFunc) ReleaseTimeout(timeout time.Duration) error {
295303
if p.IsClosed() || (!p.options.DisablePurge && p.stopPurge == nil) || p.stopTicktock == nil {
296304
return ErrPoolClosed
297305
}
298-
299-
if p.stopPurge != nil {
300-
p.stopPurge()
301-
p.stopPurge = nil
302-
}
303-
p.stopTicktock()
304-
p.stopTicktock = nil
305306
p.Release()
306307

307308
endTime := time.Now().Add(timeout)

0 commit comments

Comments
 (0)