How should I implement these 64-bit interlocked functions on WinXP? Of course I can use full mutex, but I think it's needlessly heavyweight for this task. There must be some better way.
+2
A:
You shouldn't. This is much more complex than you think.
If you insist, your best bet is to use a critical section to make sure you get the barriers right.
If you really think a critical section is too heavy weight, read up on memory barriers
Terry Mahaffey
2010-01-01 23:05:06
A:
No need to reinvent the wheel. Just use CriticalSection. If you are concerned over the performance of your interlock, the solution would be to design the program so that there is less contention, not shaving off nanoseconds off the interlock operation.
Igor Zevaka
2010-01-02 00:06:47
A:
You can also use the intrinsics which may be simpler and faster than using a critical section.
Stephen Nutt
2010-01-03 00:11:10