Hello Keith and Andrew,
The docs are right.
Multiple threads could have past the first if statement and wait for the
lock to become free.
However most of the time, you want exactly one thread to do the
operation.(whatever that is...)
After doing the operation, the lock is free for another thread
Well, based on the text, I think there was a mistake...
>> Alternatively, it might be better to use more elaborate code to
>> create rhs outside of the lock, as in the following example. Then,
>> you can use an interlocked compare exchange to update x only if it
>> is still null. This assumes