Use Interlocked* functions

Mike Hearn mh at codeweavers.com
Mon Jan 10 06:49:58 CST 2005


On Mon, 10 Jan 2005 11:38:20 +0100, Joris Huizer wrote:

> To see how far we are, I tried grepping to get This->refs stuff
>   grep -r -n -e 'TRACE(.*This->ref)' *
>   grep -r -n "++(This->ref)" *
>   grep -r -n -- "--(This->ref)" *
> 
> I hope there are a lot of false positives there :-/

You realise that not every object has to be thread safe, right? In fact
quite a few don't. Also some COM objects are internal, and others inc the
lock count inside a mutex. Finally the first grep doesn't matter as
reading a refcount is atomic anyway (but not adding or subtracting).

To be quite honest I'm not convinced this janitorial task is a good idea.
It makes the code look at first glance like it's thread safe when it
actually isn't. A better janitorial task would simply be "Make
free-threaded COM objects thread safe" except that making code thread safe
can actually be quite a lot of work, it's not just copy/paste.

thanks -mike




More information about the wine-devel mailing list