Use InterlockedCompareExchange for the lock