Know Your Library
Use provided thread-safe collections
Use the executor framework for executing unrelated tasks.
Use nonblocking solutions when possible
Know which libraries are not thread-safe.
Thread Safe Collections
Examples:
ConcurrentHashMap
,ConcurrentDictionary
, etcFeatures like lock, Semaphore, SemaphoreSlim, etc support advanced concurrency design.
Recommendation:
Review the classes available to you. Become familiar with them. Know when to use them.
Last updated