Documentation ¶
Index ¶
- type NonBlockingWorkerPool
- func (workerPool *NonBlockingWorkerPool) Capacity() int
- func (workerPool *NonBlockingWorkerPool) IdleWorkers() int
- func (workerPool *NonBlockingWorkerPool) RunningWorkers() int
- func (workerPool *NonBlockingWorkerPool) Shutdown()
- func (workerPool *NonBlockingWorkerPool) ShutdownGracefully()
- func (workerPool *NonBlockingWorkerPool) Submit(f func()) bool
- func (workerPool *NonBlockingWorkerPool) Tune(capacity int) *NonBlockingWorkerPool
- type WorkerPool
- func (workerPool *WorkerPool) Capacity() int
- func (workerPool *WorkerPool) IdleWorkers() int
- func (workerPool *WorkerPool) RunningWorkers() int
- func (workerPool *WorkerPool) Shutdown()
- func (workerPool *WorkerPool) ShutdownGracefully()
- func (workerPool *WorkerPool) Submit(f func())
- func (workerPool *WorkerPool) Tune(capacity int) *WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NonBlockingWorkerPool ¶
type NonBlockingWorkerPool struct {
// contains filtered or unexported fields
}
Implements a non-blocking (it drops tasks if the pool is full) goroutine pool with fixed capacity, managing and recycling a massive number of goroutines, allowing developers to limit the number of goroutines in your concurrent programs.
func (*NonBlockingWorkerPool) Capacity ¶
func (workerPool *NonBlockingWorkerPool) Capacity() int
Returns the capacity (number of workers) of this pool.
func (*NonBlockingWorkerPool) IdleWorkers ¶
func (workerPool *NonBlockingWorkerPool) IdleWorkers() int
Returns the available (idle) workers.
func (*NonBlockingWorkerPool) RunningWorkers ¶
func (workerPool *NonBlockingWorkerPool) RunningWorkers() int
Returns the number of the currently running workers.
func (*NonBlockingWorkerPool) Shutdown ¶
func (workerPool *NonBlockingWorkerPool) Shutdown()
Immediately closes this pool (see ShutdownGracefully for a method that waits for the running workers to finish).
func (*NonBlockingWorkerPool) ShutdownGracefully ¶
func (workerPool *NonBlockingWorkerPool) ShutdownGracefully()
Closes this pool and waits for the currently running goroutines to finish.
func (*NonBlockingWorkerPool) Submit ¶
func (workerPool *NonBlockingWorkerPool) Submit(f func()) bool
Submits a task to this pool (it drops the task if not enough workers are available). It returns false if the task could not be submitted because the pool is full.
func (*NonBlockingWorkerPool) Tune ¶
func (workerPool *NonBlockingWorkerPool) Tune(capacity int) *NonBlockingWorkerPool
Changes the capacity of this pool.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
Implements a blocking goroutine pool with fixed capacity, managing and recycling a massive number of goroutines, allowing developers to limit the number of goroutines in your concurrent programs.
func (*WorkerPool) Capacity ¶
func (workerPool *WorkerPool) Capacity() int
Returns the capacity (number of workers) of this pool.
func (*WorkerPool) IdleWorkers ¶
func (workerPool *WorkerPool) IdleWorkers() int
Returns the available (idle) workers.
func (*WorkerPool) RunningWorkers ¶
func (workerPool *WorkerPool) RunningWorkers() int
Returns the number of the currently running workers.
func (*WorkerPool) Shutdown ¶
func (workerPool *WorkerPool) Shutdown()
Immediately closes this pool (see ShutdownGracefully for a method that waits for the scheduled workers to finish).
func (*WorkerPool) ShutdownGracefully ¶
func (workerPool *WorkerPool) ShutdownGracefully()
Closes this pool and waits for the currently running goroutines to finish.
func (*WorkerPool) Submit ¶
func (workerPool *WorkerPool) Submit(f func())
Submits a task to this pool (it waits if not enough workers are available).
func (*WorkerPool) Tune ¶
func (workerPool *WorkerPool) Tune(capacity int) *WorkerPool
Changes the capacity of this pool.