csharp-concurrency-patterns
Audited by Runlayer on Feb 22, 2026
Malicious tool definition detected
Tool: SKILL.md [1/3] Description: --- name: csharp-concurrency-patterns description: Choosing the right concurrency abstraction in .NET - from async/await for I/O to Channels for producer/consumer to Akka.NET for stateful entity management.
Tool: SKILL.md [2/3] Description: item => await ProcessAsync(item)); // 4 parallel } // Complex pipeline public IRunnableGraph<Task<Done>> CreatePipeline( Source<RawEvent, NotUsed> events, Sink<ProcessedEvent, Task<Done>> sink) { return events .Where(e => e.IsValid) .GroupedWithin(50, TimeSpan.FromMilliseconds(500)) .SelectAsync(4, batch => ProcessBatchAsync(batch)) .SelectMany(results => results) .ToMaterialized(sink, Keep.Right); } ``` **Akka.NET Streams excel at:** - Batching with size AND ti
Tool: SKILL.md [3/3] Description: update(order); } } } // GOOD: Use an actor or Channel to serialize access // Each order gets its own actor - no locks needed ``` ### ❌ Manual Thread Management ```csharp // BAD: Creating threads manually var thread = new Thread(() => ProcessOrders()); thread.Start(); // GOOD: Use Task.Run or better abstractions _ = Task.Run(() => ProcessOrdersAsync(cancellationToken)); ``` ### ❌ Blocking in Async Code ```csharp // BAD: Blocking on async var result = GetDataAsync