Skip to content
This repository was archived by the owner on Jun 6, 2026. It is now read-only.

golang-design/thread

Repository files navigation

thread

Warning

This package has moved and this repository is archived.

thread now lives in the golang.design/x/runtime module as golang.design/x/runtime/thread. Update your imports:

-import "golang.design/x/thread"
+import "golang.design/x/runtime/thread"

The API is unchanged. This repository is no longer maintained; all future development happens in golang.design/x/runtime.

Package thread provides threading facilities, such as scheduling calls on a specific thread, local storage, etc.

import "golang.design/x/runtime/thread"

Quick Start

th := thread.New()
defer th.Terminate()

// Run on the thread and block until it returns.
th.Call(func() {
    // ... runs on the created thread ...
})

// Schedule on the thread without waiting.
th.Go(func() {
    // ... runs on the created thread ...
})

// Run on the thread and return a typed value.
n := thread.Eval(th, func() int {
    return 42
})

License

MIT © 2020 - 2026 The golang.design Initiative

About

🧵 thead facilities in Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages