[cairo] Fixing concurrency bugs in cairo's reference counting

Kristian Høgsberg krh at bitplanet.net
Mon Dec 18 12:44:37 PST 2006


On 12/18/06, Carl Worth <cworth at cworth.org> wrote:
> On Fri, 15 Dec 2006 11:08:43 -0500, "=?UTF-8?Q?Kristian_H=C3=B8gsberg?=" wrote:
> > I think a simpler and more consistent (and thus easier to remember)
> > rule would be to just always take a ref on behalf of the caller.
>
> The rule might be simpler, but usage would not be. So we've already
> discussed and decided against this before the 1.0 release of cairo.

Sure, it's a trade-off between API consistency and easy of use.

...
> That is, using the (fairly poor) terminology I used at the beginning
> of the thread, the "unshared source" case is exposed in the API, but
> the "shared source" case is not. That is, there's no way to ask for
> something that's sitting in a cache without any references to it.

As long as the shared resource case isn't exposed in the API, it's not
a problem.  Inside cairo we have access the the locks protecting the
data structures and can protect access to the caches etc.  My concern
was that I thought you were proposing this pattern for public API, and
I couldn't see how that would ever work.

cheers,
Kristian


More information about the cairo mailing list