Use Interlocked* functions
rob at codeweavers.com
Mon Jan 10 08:40:49 CST 2005
Mike McCormack wrote:
> The most important reason in my mind to do this is so that people
> implementing objects in the future copy code that uses the
> Interlocked* functions. There's no overhead to using those
> functions... no penalty if we use them in code that doesn't need to be
> thread safe, so we should just use them everywhere.
On uniprocessor machines this is true, but I don't think the same can be
said for SMP/SMT machines. The "lock" prefix for the instructions causes
the processor to emit a signal that tells all other processors to not
access memory for a period of time. I haven't seen any benchmarks that
say how much this costs, but it isn't "no overhead."
More information about the wine-devel