[cairo] Static caches and thread-safety

Carl Worth cworth at cworth.org
Fri Nov 12 07:49:34 PST 2004


On Fri, 12 Nov 2004 10:34:13 -0500, Keith Packard wrote:
> I think we can manage to figure out enough locking stuff to let these 
> caches be shared.

There's non-zero maintenance cost of adding locking to cairo. I don't
know what the cost of not automatically sharing caches between threads
would be. (And the clone approach would still let applications get the
sharing). I think we may just have some premature optimization here.

> However, all of that font stuff is X specific, and so requiring pthreads 
> (or other reasonable locking) for it to work efficiently doesn't seem a 
> strong limitation.

It's not all X specific. The first static cache I ran into is
_global_font_cache in cairo_font.c. It's totally generic.

If we could restrict the locking to the X-specific backend then yes, I
would feel much more comfortable.

-Carl



More information about the cairo mailing list