4/07/2008

Interlocked Class

Sometimes you'll be digging through some code and run across a system class or method that you've never seen before. Today I found this gem.


Interlocked.Increment(ref safeInstanceCount);

The Interlocked class provides a simple and elegant way to perform thread-safe atomic increment, decrement and add operations.

0 comments: