Versions in this module Expand all Collapse all v0 v0.0.3 Mar 1, 2023 v0.0.2 Sep 26, 2022 v0.0.1 Sep 23, 2022 Changes in this version + const SIZE + var ErrPoolShutdown = errors.New("pool has been shutdown") + var ErrTaskCanceled = errors.New("task has been canceled") + func WithDetectInterval(detectInterval time.Duration) dynamicOption + func WithDynamicTaskQueueCap(taskQueueCap int) dynamicOption + func WithMeetCondNum(meetCondNum int) dynamicOption + func WithTaskQueueCap(taskQueueCap int) option + type AtomicBool struct + func NewAtomicBool(flag bool) *AtomicBool + func (ab *AtomicBool) IsSet() bool + func (ab *AtomicBool) IsTrue() bool + func (ab *AtomicBool) Set(value bool) + type Callable interface + Call func(ctx context.Context) *GPResult + type DynamicGPool struct + TaskChan chan *FutureTask + func (p *DynamicGPool) Cancel() bool + func (p *DynamicGPool) CurrentGCount() int + func (p *DynamicGPool) IsShutdown() bool + func (p *DynamicGPool) Shutdown() + func (p *DynamicGPool) Submit(task Callable) (Future, error) + func (p *DynamicGPool) TaskQueueCap() int + func (p *DynamicGPool) TaskQueueLength() int + func (p *DynamicGPool) WaitTerminate() + type DynamicGPoolOption struct + type ExecutorService interface + Cancel func() bool + CurrentGCount func() int + IsShutdown func() bool + Shutdown func() + Submit func(task Callable) (Future, error) + TaskQueueCap func() int + TaskQueueLength func() int + WaitTerminate func() + func NewDynamicGPool(ctx context.Context, min int, max int, opts ...dynamicOption) ExecutorService + func NewFixedGPool(ctx context.Context, size int, opts ...option) ExecutorService + func NewSingleGPool(ctx context.Context, opts ...option) ExecutorService + type FixedGPool struct + Size int + TaskChan chan *FutureTask + func (p *FixedGPool) Cancel() bool + func (p *FixedGPool) Consume() + func (p *FixedGPool) CurrentGCount() int + func (p *FixedGPool) IsShutdown() bool + func (p *FixedGPool) Shutdown() + func (p *FixedGPool) Submit(task Callable) (Future, error) + func (p *FixedGPool) TaskQueueCap() int + func (p *FixedGPool) TaskQueueLength() int + func (p *FixedGPool) WaitTerminate() + type FixedGPoolOption struct + type Future interface + Cancel func() bool + Get func() *GPResult + IsCancelled func() bool + IsDone func() bool + type FutureTask struct + func NewFutureTask(ctx context.Context, c Callable) *FutureTask + func (f *FutureTask) Cancel() bool + func (f *FutureTask) Get() *GPResult + func (f *FutureTask) IsCancelled() bool + func (f *FutureTask) IsDone() bool + type GPResult struct + Err error + Value any + type Runnable interface + Run func(ctx context.Context) + type ShrinkWorker struct + ExitChan chan struct{} + ExitedFlag chan struct{} + RunningFlag *AtomicBool + func NewShrinkWorker(pool *DynamicGPool, interval time.Duration, meetCondNum int) *ShrinkWorker + func (w *ShrinkWorker) Start() + func (worker *ShrinkWorker) Stop() + type Worker struct + ExitChan chan struct{} + ExitedFlag chan struct{} + RunningFlag *AtomicBool + func NewWorker(pool *DynamicGPool) *Worker + func (worker *Worker) IsBusy() bool + func (worker *Worker) Start() + func (worker *Worker) Stop()