gcd-operationslisted
Install: claude install-skill christim427-rgb/ios-agent-skills
# GCD & OperationQueue Concurrency
Enterprise-grade concurrency skill for Grand Central Dispatch and OperationQueue. Opinionated: prescribes serial queues by default, target queue hierarchies, labeled queues, `NSLock`/`OSAllocatedUnfairLock` for synchronization, barrier-based reader-writer on custom concurrent queues, and OperationQueue for dependency graphs. Apple has **not deprecated any core GCD APIs** — GCD remains appropriate for parallelism, system I/O, and performance-critical paths. This skill covers correct usage, deadly bug prevention, and coexistence with Swift Concurrency.
## Concurrency Layers
```text
Application Layer -> OperationQueue for dependency graphs, cancellation, throttling.
Dispatch Layer -> Serial queues for state protection, concurrent+barrier for R/W.
Synchronization -> NSLock / OSAllocatedUnfairLock for short critical sections.
System I/O -> DispatchSource (timers, file monitoring), DispatchIO (non-blocking file I/O).
Thread Pool -> GCD manages threads. App targets 3-4 well-defined queue subsystems.
```
## Quick Decision Trees
### "Which queue type should I use?"
```
Do you need mutual exclusion (protecting shared state)?
+-- YES -> Serial queue (default). Simplest, safest.
+-- NO -> Is this independent parallel work (image processing, batch transforms)?
+-- YES -> Concurrent queue (custom) with barrier for any writes.
+-- NO -> Do you need dependency graphs, cancellation, or throttling?
+--