thread

package
v1.12.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BreakLoop = errors.New("break loop")

BreakLoop represents an termination of the loop.

Functions

This section is empty.

Types

type Thread

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

Thread represents an OS thread.

func New

func New() *Thread

New creates a new thread.

It is assumed that the OS thread is fixed by runtime.LockOSThread when New is called.

func (*Thread) Call

func (t *Thread) Call(f func() error) error

Call calls f on the thread.

Do not call this from the same thread. This would block forever.

If f returns BreakLoop, Loop returns.

Call blocks if Loop is not called.

func (*Thread) Loop

func (t *Thread) Loop()

Loop starts the thread loop until a posted function returns BreakLoop.

Loop must be called on the thread.

Jump to

Keyboard shortcuts

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