forked from mirror/ants
Merge branch 'master' into develop
This commit is contained in:
commit
418888be9d
6
pool.go
6
pool.go
|
@ -146,10 +146,8 @@ 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,10 +148,8 @@ 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue