Use Interlocked* functions

Mike Hearn mh at codeweavers.com
Mon Jan 10 09:04:53 CST 2005


On Mon, 10 Jan 2005 22:42:22 +0000, Mike McCormack wrote:
> Well, it's true that some objects don't need to be thread safe, however 
> it's not recorded anywhere in the Wine source which object need to be 
> thread safe and which don't.

That info is usually available in MSDN or the registry. But I admit it's
not always obvious at first sight.
 
> 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.

Technically there is as it causes a bus assert and a dcache flush on SMP
machines but I doubt we care about tiny hits.

> The janitorial task doesn't say "Make ole32 objects thread safe" because
> that's alot more work.  It is one small step in the process of making
> objects thread safe... an introduction if you like.  Hopefully it helps
> some newcomers to Wine understand thread safety and OLE objects a
> little.  Maybe then oneday they'll can that the code isn't thread safe,
> and undertake to fix some of it, which is a much bigger and harder task.
> 
> Until then this is something easy for people to do to help out.

Yes fair enough, it is work that would otherwise have to be done some
other time so it's good to get it done now.

thanks -mike




More information about the wine-devel mailing list