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

type NoopThread struct{}

NoopThread is used to disable threading.

func (*NoopThread) Call

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

Call executes the func immediately

func (*NoopThread) Loop

func (t *NoopThread) Loop()

Loop does nothing

type OSThread

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

OSThread represents an OS thread.

func NewOSThread

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

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

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

func NewNoopThread() Thread

NewNoopThread creates a new thread that does no threading.

Source Files