Examples from Chapter 16 (Multithreading) of Programming C# 10.0 (O'Reilly).
- Example 1. Object visibility and methods
- Example 2. Non-thread-safe use of a thread-safe collection
- Example 3. Using ThreadLocal<T>>
- Example 4. Creating threads
- Example 5. Running code on the thread pool with a Task
- Example 6. Using the thread pool and then SynchronizationContext
- Example 7. Using ExecutionContext
- Example 8. Protecting state with lock
- Example 9. How lock blocks expand
- Example 10. Wait and Pulse
- Example 11. Protecting access to a decimal with SpinLock
- Example 12. Waiting for work to complete with ManualResetEvent
- Example 13. Using CompareExchange
- Example 14. Using LazyInitializer
- Example 15. Task-based web download
- Example 16. Getting a task’s results with await
- Example 17. A continuation
- Example 18. Scheduling a continuation of a continuation
- Example 19. Scheduling a continuation on the UI thread
- Example 20. Using TaskCompletionSource<T>
- Example 21. An APM pair and the corresponding synchronous method
- Example 22. Parallel convolution