conc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: BSD-3-Clause Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SingleQueue

type SingleQueue struct {
	// contains filtered or unexported fields
}

SingleQueue is a concurrency queue that supports only one function. Each process waits its turn to execute. A number n of processes may run at concurrently. The queue waits for all processes to finish.

func NewSingleQueue

func NewSingleQueue(n int) *SingleQueue

NewSingleQueue creates a new concurrency queue of type SingleQueue. Parameter n is the number of processes allowed to be run concurrently. If n <= 0, then n=runtime.NumCPU().

func (*SingleQueue) Allowed

func (q *SingleQueue) Allowed() int

func (*SingleQueue) Run

func (q *SingleQueue) Run(f func(int), i int)

Run queries the SingleQueue to run function f with id i. It may or may not run immediately.

func (*SingleQueue) Wait

func (q *SingleQueue) Wait()

Wait waits for all the processes to finish.

Jump to

Keyboard shortcuts

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