[cairo] [PATCH] Do not hold mutexes when calling destructors.
jeff at infidigm.net
Thu May 15 12:50:41 PDT 2008
On Thu, May 15, 2008 at 03:14:37PM -0400, Behdad Esfahbod wrote:
> On Thu, 2008-05-15 at 15:15 -0400, Jeff Muizelaar wrote:
> > On Tue, May 13, 2008 at 12:25:18PM -0400, Behdad Esfahbod wrote:
> > > On Tue, 2008-05-13 at 11:29 -0400, Jeff Muizelaar wrote:
> > > >
> > > > Perhaps. Is there an advantage to clearing the whole cache
> > atomically?
> > > > If not, I don't really see what making a copy buys us.
> > >
> > > Doing only two mutex operations instead of 32...
> > The function is only ever called by cairo_debug_reset_static_data() so
> > performance doesn't matter at all.
> What if another thread modifies the cache while you have released the
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
More information about the cairo