mlxthread

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStopped = errors.New("mlx thread stopped")

Functions

func Call

func Call[T any](ctx context.Context, t *Thread, fn func() (T, error)) (T, error)

Types

type Thread

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

func Start

func Start(name string, init func() error) (*Thread, error)

Start creates a long-lived worker goroutine locked to one OS thread.

func (*Thread) Do

func (t *Thread) Do(ctx context.Context, fn func() error) error

Do runs fn on the locked OS thread.

Context cancellation only applies while the work is queued. Once the worker accepts a job, the job runs until fn returns or reaches its own cancellation checks.

func (*Thread) Stop

func (t *Thread) Stop(ctx context.Context, cleanup func()) error

Stop runs cleanup on the locked OS thread and then shuts the worker down.

Jump to

Keyboard shortcuts

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