Developer Geeks Home

Thread Synchronization Essentials in .Net

RSS
 

  • Posted one year ago
  • Category: .Net Framework, ASP .Net, C#,
  • Audiences: Architect, Developer, System Analyst,

This is a brief article showing what are the essentials of synchronization in thread.

Thread Synchronization Essentials

The following tables summarize the .NET tools available for coordinating or synchronizing the actions of threads:

Simple Blocking Methods

Sleep - Blocks for a given time period.

Join - Waits for another thread to finish.

Locking Constructs

Lock - Ensures just one thread can access a resource, or section of code.

Mutex - Ensures just one thread can access a resource, or section of code. It can be used to prevent multiple instances of an application from starting.

Semaphore - Ensures not more than a specified number of threads can access a resource, or section of code.

Signaling Constructs

EventWaitHandle - Allows a thread to wait until it receives a signal from another thread.

Wait and Pulse - Allows a thread to wait until a custom blocking condition is met.

Non-Blocking Synchronization Constructs

Interlocked - To perform simple non-blocking atomic operations.

Volatile - To allow safe non-blocking access to individual fields outside of a lock.

comments powered by Developer Geeks

My Recent Articles [86]