m07-concurrency/SKILL.md
Mastering C++ Concurrency. Triggers: std::thread, jthread, atomic, mutex, deadlock, race condition, memory model, coroutine, async.
npx skillsauth add 13eholder/modern-cpp-skills m07-concurrencyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
How do threads communicate?
std::mutex) or Atomics (std::atomic).std::condition_variable) or Latches/Semaphores (C++20).std::async or Coroutines (C++20).| Issue | Design Question | | ----------------- | ------------------------------------------------------------------ | | Data Race | Are two threads accessing memory without a Happens-Before edge? | | Deadlock | Did you lock Mutex A then B, while another thread locked B then A? | | False Sharing | Are independent atomics sitting on the same cache line? | | Live Lock | Are threads spinning without progress? |
Do I need a thread?
std::async or Thread Pool.std::jthread.Is it shared state?
std::mutex.std::atomic.Locks or Atomics?
counter++ is Read-Modify-Write, not atomic. Data race.std::atomic<int>.| Tool | C++ Version | Use When |
| ----------------------- | ----------- | ----------------------------- |
| std::jthread | C++20 | Standard thread (auto-join). |
| std::atomic | C++11 | Lock-free counters/flags. |
| std::mutex | C++11 | Locking critical sections. |
| std::shared_mutex | C++17 | Read-heavy workloads. |
| std::latch | C++20 | Waiting for N tasks to start. |
| co_await | C++20 | Async I/O (requires library). |
tools
Common C++ Anti-Patterns. Triggers: global variables, new/delete, C-style cast, macros, void*.
data-ai
C++ Mental Models: Pointer vs Reference, Initialization, Undefined Behavior.
data-ai
Mastering C++ Domain Errors: Exception Hierarchies, System Errors, and Expected.
data-ai
Mastering C++ Lifecycle: RAII, Destructors, Static Initialization, Rule of 5.