mirror of https://github.com/panjf2000/ants.git
update codecov test
This commit is contained in:
parent
d31b2413c6
commit
4553a7a1c6
9
pool.go
9
pool.go
|
@ -145,14 +145,13 @@ func (p *Pool) Cap() int {
|
||||||
func (p *Pool) ReSize(size int) {
|
func (p *Pool) ReSize(size int) {
|
||||||
if size == p.Cap() {
|
if size == p.Cap() {
|
||||||
return
|
return
|
||||||
} else if size < p.Cap() {
|
}
|
||||||
diff := p.Cap() - size
|
atomic.StoreInt32(&p.capacity, int32(size))
|
||||||
atomic.StoreInt32(&p.capacity, int32(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
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
atomic.StoreInt32(&p.capacity, int32(size))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,14 +150,13 @@ func (p *PoolWithFunc) Cap() int {
|
||||||
func (p *PoolWithFunc) ReSize(size int) {
|
func (p *PoolWithFunc) ReSize(size int) {
|
||||||
if size == p.Cap() {
|
if size == p.Cap() {
|
||||||
return
|
return
|
||||||
} else if size < p.Cap() {
|
}
|
||||||
diff := p.Cap() - size
|
atomic.StoreInt32(&p.capacity, int32(size))
|
||||||
atomic.StoreInt32(&p.capacity, int32(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
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
atomic.StoreInt32(&p.capacity, int32(size))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue