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
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.
Add vthread to your project:
[dependencies]
vthread = "=0.1.0"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.
zcheck run checkThe 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.
vthread 0.1.0 is production ready within the documented supported workloads and
platforms, with a deliberately limited feature set. Public APIs and supported
contracts remain compatible throughout 0.1.x; breaking changes require 0.2.
Tested configurations and known limitations are in the release notes.
Reference application · Benchmarks · Runtime evidence · Contributing · Security
Apache-2.0. See LICENSE.