From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-06-08 06:49:22
>AFAIK, the atomic counter you are referring to (I assume
InterlockedIncrement here) is a fairly heavyweight function call designed
work on SMP systems, and not the simple one-instruction atomic
count-and-test which is available in almost all ISAs. One would expect the
latter to show a much greater improvement in speed.
That will teach me to selectively quote - the times were taken from "An
Atomic Counter for Guaranteed Thread Safety" by John M. Dlugosz in August
98 Visual C++ Developer, and is all about using assembly to do locked
increments and decrements, unfortunately closer re-reading shows that you
are correct - the author quotes times for InterlockedIncrement and not his
own primitives! As you say a simple atomic op should be better still.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk