Tune changes the capacity of this pool, note that it is noneffective to the infinite or pre-allocation pool.
(size int)
| 361 | |
| 362 | // Tune changes the capacity of this pool, note that it is noneffective to the infinite or pre-allocation pool. |
| 363 | func (p *poolCommon) Tune(size int) { |
| 364 | capacity := p.Cap() |
| 365 | if capacity == -1 || size <= 0 || size == capacity || p.options.PreAlloc { |
| 366 | return |
| 367 | } |
| 368 | atomic.StoreInt32(&p.capacity, int32(size)) |
| 369 | if size > capacity { |
| 370 | if size-capacity == 1 { |
| 371 | p.cond.Signal() |
| 372 | return |
| 373 | } |
| 374 | p.cond.Broadcast() |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | // IsClosed indicates whether the pool is closed. |
| 379 | func (p *poolCommon) IsClosed() bool { |