m07-concurrency

Identify and enforce safe concurrency patterns in Rust codebases.

1|2|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/dojoengine/torii-core --skill m07-concurrency-dojoengine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m07-concurrency
Source: https://github.com/dojoengine/torii-core/tree/main/.agents/skills/m07-concurrency
Command: npx skills add https://github.com/dojoengine/torii-core --skill m07-concurrency-dojoengine

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Concurrency planning and safe parallelism guidance for Rust in complex apps.

Core Features & Use Cases

  • Pattern catalog: comprehensive set of concurrency primitives and patterns (spawn, join, channels, mutexes, Arc, etc.) with guidance on when to use each.
  • Anti-patterns: common mistakes and how to avoid them (deadlocks, holding locks across await, non-Send types in async).
  • Practical scenarios: examples for CPU-bound, I/O-bound, and mixed workloads in real-world Rust services.

Quick Start

Run through the included examples to learn safe concurrency, then apply patterns to your own async Rust codebases.

Frequently Asked Questions about m07-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What's the best way to handle async concurrency in Rust without deadlocks?

To prevent deadlocks in Rust async concurrency, avoid holding mutexes across await points and ensure futures remain Send. Use structured concurrency patterns with channels to coordinate tasks safely across I/O-bound workloads.

How do I choose between threads and async Tokio for CPU-bound vs I/O-bound workloads in Rust?

Selecting between threads and async Tokio depends on the workload: use OS threads for CPU-bound parallelism and Tokio async tasks for I/O-bound concurrency. Structured concurrency patterns help manage mixed workloads effectively in Rust services.

When do I need Send and Sync bounds for Rust async tasks?

You need Send and Sync bounds in Rust async tasks when passing data across threads or spawning tasks on a multi-threaded Tokio executor. These thread-safety guarantees ensure non-Send types do not cause runtime errors in concurrent environments.

How do I implement structured concurrency patterns in Rust using channels and Arc?

Implement structured concurrency in Rust by using channels for task communication and Arc for shared ownership across spawned tasks. This pattern ensures safe parallelism, robust error handling, and clear task lifecycles in complex async applications.

What are common anti-patterns when using mutexes in Rust async code?

Common Rust async anti-patterns include holding mutexes across await points, which causes deadlocks, and spawning non-Send types into multi-threaded executors. Avoid these by using scoped locks and ensuring task futures satisfy Send bounds.