thread

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 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 NoopThread added in v2.1.0

type NoopThread struct{}

NoopThread is used to disable threading.

func (*NoopThread) Call added in v2.1.0

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

Call executes the func immediately

func (*NoopThread) Loop added in v2.1.0

func (t *NoopThread) Loop()

Loop does nothing

type OSThread added in v2.1.0

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

OSThread represents an OS thread.

func NewOSThread added in v2.1.0

func NewOSThread() *OSThread

NewOSThread creates a new thread.

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

func (*OSThread) Call added in v2.1.0

func (t *OSThread) 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 (*OSThread) Loop added in v2.1.0

func (t *OSThread) Loop()

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

Loop must be called on the thread.

type Thread

type Thread interface {
	Call(func() error) error
	Loop()
}

Thread defines threading behavior in Ebiten.

func NewNoopThread added in v2.1.0

func NewNoopThread() Thread

NewNoopThread creates a new thread that does no threading.

Jump to

Keyboard shortcuts

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