[cairo] [PATCH] Do not hold mutexes when calling destructors.

Behdad Esfahbod behdad at behdad.org
Thu May 15 12:51:05 PDT 2008

On Thu, 2008-05-15 at 15:50 -0400, Jeff Muizelaar wrote:
> That's a more interesting concern. In practice everything should be
> fine
> as we don't hold any special state across the lock release. I.e. if an
> entry we'll added to the cache we'll just remove it in the next loop
> iteration and if an entry was removed that's fine to. However, in
> theory everytime we released the lock a new cache entry could be added
> and the loop would never terminate. I agree that this property isn't
> really useful and can redo the patch to use a copy if this situation
> matters enough. 

If you don't lock, you don't have any memory barriers. You may try to
remove a pointer from the cache without having the memory it points to
visible in your view of the memory.  Something like that.  I'm sure
there are architectures that this scheme is broken on.

> -Jeff

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list