Quickie: Is iCounter += iSomeVal; thread-safe?

Started by
9 comments, last by CWizard 21 years, 8 months ago
This thread should probably just die out, but just one more question here. I checked the disassembly of the InterlockedExchangeAdd(), which was:
77E76B5C   mov         ecx,dword ptr [esp+4]77E76B60   mov         eax,dword ptr [esp+8]77E76B64   lock xadd   dword ptr [ecx],eax77E76B68   ret         8 
. But, before that, a lot of overhead. Could one instead make this a inline unsing a macro? What instruction is that "lock xadd", and which processors support it?

This topic is closed to new replies.

Advertisement