custom_nosleep

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Unbounded = -1

Unbounded indicates that the Queue should have no memory bounds.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// Max is the maximum size the Buffer can grow to.  Use Unbounded if
	// you wish to grow the buffer to any size. By default this will grow to 1k items.
	Max int
	// contains filtered or unexported fields
}

Buffer provides a FIFO circular buffer that can grow and shrink as required. Buffer must not be copied after creation (which means use a pointer if passing between functions).

func (*Buffer) Force

func (c *Buffer) Force(item interface{})

Force will push the item onto the buffer and blocks until the operation completes.

func (*Buffer) Pop

func (c *Buffer) Pop() (value interface{}, ok bool)

Pop returns the next value off the circular buffer. If the buffer is empty ok will be false.

func (*Buffer) Pull

func (c *Buffer) Pull() interface{}

Pull pulls an item off the circular buffer. It blocks until a value is found.

func (*Buffer) Push

func (c *Buffer) Push(item interface{}) (ok bool)

Push pushes an item onto the circular buffer. "ok" indicates if this happens.

Jump to

Keyboard shortcuts

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