Versions in this module Expand all Collapse all v1 v1.0.0 Dec 14, 2018 Changes in this version + const DefaultSize + var ErrPoolClosed = errors.New("pool closed") + var ErrPoolSize = errors.New("pool size less than or equal 0") + var ErrPoolUnavailable = errors.New("pool temporarily unavailable") + var ErrTaskQueueClosed = errors.New("task queue closed") + var ErrTaskQueueEmpty = errors.New("task queue is empty") + var ErrUnstoppableWorkers = errors.New("unstoppable workers count less than 0") + type Callable interface + Call func() + Error func() error + Result func() interface{} + type Config struct + Size int + UnstoppableWorkers int + type CustomCallable struct + func NewCustomCallable(f func(...interface{}) (interface{}, error), args ...interface{}) *CustomCallable + func (cc *CustomCallable) Call() + func (cc *CustomCallable) Error() error + func (cc *CustomCallable) Result() interface{} + type CustomTask struct + func NewCustomTask(f func(...interface{}) (interface{}, error), args ...interface{}) *CustomTask + func (ct *CustomTask) Cancel() + func (ct *CustomTask) Error() error + func (ct *CustomTask) Get() interface{} + func (ct *CustomTask) IsCancelled() bool + func (ct *CustomTask) IsDone() bool + func (ct *CustomTask) Panic() interface{} + func (ct *CustomTask) Run() + type Pool struct + func NewPool(c *Config) *Pool + func (p *Pool) ActiveCount() int + func (p *Pool) Close() + func (p *Pool) IsClosed() bool + func (p *Pool) SetSize(size int) error + func (p *Pool) SetUnstoppableWorkers(count int) error + func (p *Pool) Size() int + func (p *Pool) Submit(t Task) error + func (p *Pool) SubmitCustom(ctx context.Context, completion chan<- Task, t Task) error + func (p *Pool) SubmitImmediate(t Task) error + func (p *Pool) SubmitWithCompletion(completion chan<- Task, t Task) error + func (p *Pool) SubmitWithContext(ctx context.Context, t Task) error + func (p *Pool) TaskQueue() TaskQueue + func (p *Pool) UnstoppableWorkers() int + func (p *Pool) Wait() + type Task interface + Cancel func() + Error func() error + Get func() interface{} + IsCancelled func() bool + IsDone func() bool + Panic func() interface{} + Run func() + type TaskQueue interface + Put func(t Task) error + Size func() int + Take func() (Task, error)