Skip to content

Repository files navigation

vthread

Carrier-affine virtual threads for Rust.

vthread runs ordinary synchronous functions on reusable stacks, with structured task ownership, bounded resources, and explicit suspension.

Model · Start · Qualification · Docs


Model

Tasks belong to a scope or supervisor. Scopes own their children; dropping a join handle never detaches work. Started tasks never migrate between carrier threads, so they can keep values such as Rc across suspension.

Task admission, queues, stacks, waiters, timers, I/O registrations, and native jobs have explicit bounds. Cancellation is cooperative and observed at checkpoints. An operation that reaches a suspension boundary returns Error::SuspensionDuringPanic instead of switching tasks while its carrier is handling a panic.

The runtime provides synchronization, bounded channels, networking, DNS, filesystem operations, and native blocking delegation. Diagnostics expose task names, park reasons, and snapshots.

Start

Add vthread to your project:

[dependencies]
vthread = "=0.1.0-rc.2"
fn main() -> vthread::Result<()> {
    vthread::run(|scope| {
        let mut answer = scope.spawn("answer", || 52)?;
        println!("{}", answer.join()?);
        Ok(())
    })
}

Standard-library blocking calls are not virtualized. Use vthread operations or vthread::blocking::run; blocking native calls occupy the task's carrier.

Qualification

zcheck run check

The complete gate covers formatting, Clippy, native debug and release tests, feature combinations, rustdoc, architecture, and application and benchmark checks.

vthread requires Rust 1.96 or newer, Linux x86_64 or macOS ARM64, and unwinding panics. Builds with panic = "abort" are rejected. See release notes for verification coverage and known limitations.

Compatibility

vthread 0.1.0-rc.2 is a candidate for production use on its supported platforms within the documented boundaries. The eventual 0.1.0 release and subsequent 0.1.x releases will keep compatible public API updates within 0.1; breaking API or contract changes move to 0.2. Tested configurations and known limitations are in the release notes.

Docs

Reference application · Benchmarks · Runtime evidence · Contributing · Security

License

Apache-2.0. See LICENSE.

About

virtual threads for rust

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages