async

package
v0.0.0-...-99c4d88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL