thread

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoopThread

type NoopThread struct{}

NoopThread is used to disable threading.

func NewNoopThread

func NewNoopThread() *NoopThread

NewNoopThread creates a new thread that does no threading.

func (*NoopThread) Call

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

Call executes the func immediately

func (*NoopThread) Loop

func (t *NoopThread) Loop(ctx context.Context) error

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.

func (*OSThread) Call

func (t *OSThread) Call(f func())

Call calls f on the thread.

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

Call blocks if Loop is not called.

func (*OSThread) Loop

func (t *OSThread) Loop(ctx context.Context) error

Loop starts the thread loop until Stop is called on the current OS thread.

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