Threading in C# - Basic Synchronization
Locking Constructs
Construct
Purpose
Cross-Process?
Speed
Ensures just one thread can access a resource, or section of code.
no
fast
Ensures just one thread can access a resource, or section of code.
Can be used to prevent multiple instances of an application from starting.moderate
Ensures not more than a specified number of threads can access a resource, or section of code.
yes
moderate
via albahari.com