task

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a FIFO container of tasks. The zero value is an empty queue.

func (*Queue) Append

func (q *Queue) Append(other *Queue)

Append pops the contents of another queue and pushes them onto the end of this queue.

func (*Queue) Empty added in v0.14.0

func (q *Queue) Empty() bool

Empty checks if the queue is empty.

func (*Queue) Pop

func (q *Queue) Pop() *Task

Pop a task off of the queue.

func (*Queue) Push

func (q *Queue) Push(t *Task)

Push a task onto the queue.

type Stack

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

Stack is a LIFO container of tasks. The zero value is an empty stack. This is slightly cheaper than a queue, so it can be preferable when strict ordering is not necessary.

func (*Stack) Pop

func (s *Stack) Pop() *Task

Pop a task off of the stack.

func (*Stack) Push

func (s *Stack) Push(t *Task)

Push a task onto the stack.

func (*Stack) Queue

func (s *Stack) Queue() Queue

Queue moves the contents of the stack into a queue. Elements can be popped from the queue in the same order that they would be popped from the stack.

type Task

type Task struct {
	// Next is a field which can be used to make a linked list of tasks.
	Next *Task

	// Ptr is a field which can be used for storing a pointer.
	Ptr unsafe.Pointer

	// Data is a field which can be used for storing state information.
	Data uint
	// contains filtered or unexported fields
}

Task is a state of goroutine for scheduling purposes.

Jump to

Keyboard shortcuts

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