Skip to main content

Posts

Showing posts with the label AutoResetEvent

Data Sharing Across Threads in .Net

Namespace: System.Threading Avoiding Collisions :                 Collision may occur while accessing data from multiple threads. Two threads loaded the same value, updated and set the value at the same time, and leaving the data in inconsistent state. Interlocked class can perform the arithmetic operations as single a single operation. These arithmetic operations include: Add, Decrement, Exchange, Increment, and Read operations. Synchronization Locks : C# lock can be used to make single thread enter the specified code at one time. Like:                 lock (this Or any Object)                 {                 } It’s an object base lock. We will face a de...