Merge pull request #14 from SimePel/master

Remove meaningless if statements
This commit is contained in:
Andy Pan 2018-10-02 21:52:27 +08:00 committed by GitHub
commit 29730bb703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -146,12 +146,10 @@ func (p *Pool) ReSize(size int) {
} }
atomic.StoreInt32(&p.capacity, int32(size)) atomic.StoreInt32(&p.capacity, int32(size))
diff := p.Running() - size diff := p.Running() - size
if diff > 0 {
for i := 0; i < diff; i++ { for i := 0; i < diff; i++ {
p.getWorker().task <- nil p.getWorker().task <- nil
} }
} }
}
// Release Closes this pool. // Release Closes this pool.
func (p *Pool) Release() error { func (p *Pool) Release() error {

View File

@ -148,12 +148,10 @@ func (p *PoolWithFunc) ReSize(size int) {
} }
atomic.StoreInt32(&p.capacity, int32(size)) atomic.StoreInt32(&p.capacity, int32(size))
diff := p.Running() - size diff := p.Running() - size
if diff > 0 {
for i := 0; i < diff; i++ { for i := 0; i < diff; i++ {
p.getWorker().args <- nil p.getWorker().args <- nil
} }
} }
}
// Release Closed this pool. // Release Closed this pool.
func (p *PoolWithFunc) Release() error { func (p *PoolWithFunc) Release() error {