Invoke passes the argument to the pool to start a new task.
(arg T)
| 32 | |
| 33 | // Invoke passes the argument to the pool to start a new task. |
| 34 | func (p *PoolWithFuncGeneric[T]) Invoke(arg T) error { |
| 35 | if p.IsClosed() { |
| 36 | return ErrPoolClosed |
| 37 | } |
| 38 | |
| 39 | w, err := p.retrieveWorker() |
| 40 | if w != nil { |
| 41 | w.(*goWorkerWithFuncGeneric[T]).arg <- arg |
| 42 | } |
| 43 | return err |
| 44 | } |
| 45 | |
| 46 | // NewPoolWithFuncGeneric instantiates a PoolWithFuncGeneric[T] with customized options. |
| 47 | func NewPoolWithFuncGeneric[T any](size int, pf func(T), options ...Option) (*PoolWithFuncGeneric[T], error) { |
nothing calls this directly
no test coverage detected