Documentation ¶
Index ¶
- Constants
- type Option
- type Violin
- func (v *Violin) Consume(taskC chan func())
- func (v *Violin) ConsumeWait(taskC chan func())
- func (v *Violin) IsCleaning() bool
- func (v *Violin) IsPlaying() bool
- func (v *Violin) IsShutdown() bool
- func (v *Violin) MaxWorkerNum() int
- func (v *Violin) Pause(ctx context.Context)
- func (v *Violin) Shutdown()
- func (v *Violin) ShutdownWait()
- func (v *Violin) Submit(task func())
- func (v *Violin) SubmitWait(task func())
- func (v *Violin) TaskNum() uint32
- func (v *Violin) WaitingTaskNum() int
- func (v *Violin) WorkerNum() uint32
Constants ¶
const ( Name = "VIOLIN" Version = "v0.3.1" )
BINARY-VIOLIN
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
func WithMaxWorkers ¶
WithMaxWorkers set the maximum number of workers
func WithWorkerIdleTimeout ¶
WithWorkerIdleTimeout set the destroyed timeout of idle workers
type Violin ¶
type Violin struct {
// contains filtered or unexported fields
}
Violin VIOLIN worker pool
func (*Violin) Consume ¶ added in v0.2.1
func (v *Violin) Consume(taskC chan func())
Consume the current tasks in the taskC Note: Consume will not execute the tasks which put into the taskC after calling Consume
func (*Violin) ConsumeWait ¶ added in v0.2.1
func (v *Violin) ConsumeWait(taskC chan func())
ConsumeWait consume tasks in the taskC and wait for them to complete Note: ConsumeWait will not execute the tasks which put into the taskC after calling ConsumeWait
func (*Violin) IsCleaning ¶
IsCleaning returns true if the worker pool is cleaning (graceful shutdown)
func (*Violin) IsShutdown ¶
IsShutdown returns true if the worker pool is shutdown
func (*Violin) MaxWorkerNum ¶
MaxWorkerNum returns the maximum number of workers
func (*Violin) ShutdownWait ¶
func (v *Violin) ShutdownWait()
ShutdownWait graceful shutdown, wait for all tasks to complete
func (*Violin) SubmitWait ¶
func (v *Violin) SubmitWait(task func())
SubmitWait submit a task to the worker pool and wait for it to complete
func (*Violin) WaitingTaskNum ¶
WaitingTaskNum returns the number of waiting tasks