[cairo] Re: Thread-specific linked-list for locked FT_Face objects
otaylor at redhat.com
Tue Feb 13 09:22:21 PST 2007
On Tue, 2007-02-13 at 08:25 -0800, Keith Packard wrote:
> On Tue, 2007-02-13 at 02:28 -0800, Carl Worth wrote:
> > Given all the above, what we decided to implement is a simple linked
> > list of locked FT_Face objects stored in a thread-specific data
> > area.
> I suggest that we treat this part of the API as broken-by-design and try
> to come up with a thread-safe way of accessing FreeType objects that
> doesn't rely on cairo using ugly tricks of this nature. I think this
> will require thread-safe interfaces in FreeType, which appears to be the
> basic source of the difficulty.
What sort of API would you suggest instead?
With the FreeType limitations that David has described, of course, the
options are pretty limited:
A) You could try to wrap all relevant bits FreeType, so that you could
have a big global lock around FreeType inside of cairo.
(Glancing through Pango, there is FT_Get_Kerning, FT_Load_Glyph,
some direct access to face->size->metrics, a few other things like
that ... it's within reason to wrap these portions. but obviously
it significantly restricts the ways you can combine cairo with
B) You could expose a big global lock around all FreeType operations
to the application. Could be very prone to deadlock creation.
More information about the cairo