VB.NET System.Threading.Interlocked

Refer to ReadWriteLock Sample.

ReadWriteLock and Interlocked are built on the same basis:

  • Read - Multiple simultaneous
  • Write - One by one in queue.

Thus both System.Threading.Interlocked and System.Threading.ReadWriteLock have the same speed.

There is no delay when using System.Threading.Interlocked.Exchange.

The only bottleneck possibility is at the display.

Make sure you adjust the displaying timer's interval according to the collection's size. Let's say you have 5 objects, thus the proper speed is 1000(ms)/5(objects) for the interval.

Download the sample code (VS 2008 SP1)

Comments