Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs and reviews Rust async code for task ownership, suspension points, cancellation, blocking work, and Tokio runtime boundaries.
95% 100%+5 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 21 of 22 without it.
When spawning critical background processing tasks with `tokio::spawn`, is it fine to drop the returned handle immediately if I don't need its immediate return value?
Advises keeping JoinHandles to monitor, await, or abort critical background tasks
3 of 3 safety checks passed
Use this skill to make Rust async code explicit about task ownership, suspension points, blocking work, and cancellation. Async is a concurrency model, not a default replacement for threads or a performance guarantee.
.await as a possible suspension point. Check what state is held
across it.tokio::spawn(async move { ... }) only when the task can own everything
it needs and its future is Send + 'static on the selected runtime.JoinHandles when task success, panic, cancellation, or shutdown
matters. Do not silently detach important work.spawn_blocking, Rayon, or dedicated threads as the workload requires.MutexGuard, RefCell borrow, or non-Send value
across .await.Read references/async-runtime-patterns.md when reviewing task spawning,
shared state in async code, or blocking work.
std::sync::Mutex in async code only for short, low-contention critical
sections that do not cross .await.tokio::sync::Mutex when a lock must be held across .await, but first
consider moving the state behind a task and interacting by messages.spawn_blocking for blocking operations that eventually finish. Limit
parallelism for CPU-heavy work; Tokio's blocking pool can grow large.tokio::time::timeout or explicit cancellation tokens for bounded
operations.select! carefully: dropping a future can cancel it. Check cancellation
safety before using it around IO or partially completed work.Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.