This section is empty.


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

BreakLoop represents an termination of the loop.


This section is empty.


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.

Source Files