Re: How to do atomic read?




<0dbell@xxxxxxxxx> wrote in message
news:1182342432.384995.41330@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

But, in case I am not seeing the obvious, what's wrong with:

LONG asignee = InterlockedExchange(&var, var);


First, it's NOT atomic. There is a window for change. This IS atomic:

LONG asignee = InterlockedCompareExchange(&var, 0, 0);


.


Loading