[PATCH] Potential reference count races

Nikolay Sivov bunglehead at gmail.com
Sun Oct 28 01:40:32 CDT 2012


On 10/28/2012 04:59, max at mtew.isa-geek.net wrote:
> From: Max TenEyck Woodbury <max at mtew.isa-geek.net>
>
> I have been looking at the Microsoft COM and related documentations
> and noticed that they emphatically recomend using the Interlocked...
> functions when manipulating reference counts.  I managed to set up a
> search that showed where many of the reference count updates occur and
> was somewhat surprised at how often this advice was not followed.
It doesn't mean it always has to be followed.
>
> While I have not converted every reference count update to use the
> Interlocked... functions, this set of patches fixes a fair number of
> them.
>
> These are not associated with any particular bug report; they are simply
> a general precausion against operations that are known to be associated
> with race conditions.
This precaution doesn't work in general. It's not enough to atomically 
update refcount to make
an implementation thread safe. Also not everything is supposed to be 
thread safe in a first place.

Changes like this:

> -	    for (i=0;i<howmuch;i++)
> +	    for (i=0;i<howmuch;++i)
>   		TRACE("notify at %d to %p\n",
>   		    notify[i].dwOffset,notify[i].hEventNotify);
are not helpful at all.

>
> The patches are independent of each other.  They are NOT a series.
>




More information about the wine-devel mailing list