priorityqueue

package
v3.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: GPL-3.0, LGPL-3.0, LGPL-3.0-or-later Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContention = errors.New("contention")
)

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue struct {
	Queues []chan interface{}
	// contains filtered or unexported fields
}

PriorityQueue is the basic structure

func New

func New(n int, l int) *PriorityQueue

New is the constructor for PriorityQueue

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{}, p int) error

Push pushes an item to the appropriate queue specified in the priority argument if context is given it waits until either the item is pushed or the Context aborts

func (*PriorityQueue) Run

func (pq *PriorityQueue) Run(ctx context.Context, f func(interface{}))

Run is a forever loop popping items from the queues

Jump to

Keyboard shortcuts

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