[cairo] Static caches and thread-safety

Carl Worth cworth at cworth.org
Thu Nov 11 11:27:03 PST 2004


So I notice that the recent font cache work adds the first instance of
static data to cairo. This is therefore the first thread-unsafe code I'm
aware of in cairo, (and to the extent that even locking cairo_t* objects
won't help).

This can't stay this way. The patch did add stubs acknowledging the
deficiency:

	static void
	_lock_global_font_cache (void)
	{
	    /* FIXME: implement locking. */
	}

	static void
	_unlock_global_font_cache (void)
	{
	    /* FIXME: implement locking. */
	}

	static cairo_cache_t *
	_global_font_cache = NULL;

But how shall we fix this?

-Carl



More information about the cairo mailing list