A simple performance test: Interlocked vs lock

Using Interlocked.CompareExchange is not always as fast as you think it
should be - sometimes a simple lock will be better.