freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Clarification about FT_Init_FreeType in a multithreaded environ


From: Werner LEMBERG
Subject: Re: [ft] Clarification about FT_Init_FreeType in a multithreaded environment
Date: Wed, 12 Jun 2013 19:02:32 +0200 (CEST)

>> In other words, functions related to FT_Face (temporarily)
>> manipulate data in the various FreeType font driver, hinting, and
>> renderer modules, and those modules are contained in FT_Library.
> 
> Just to confirm, the "autofitter module's (global) data structure"
> is not really global but attached to the library, or?

Yes.

> If it is attached to the library, two library instances are
> completely separate, and using them from different threads even when
> using the autofitter will work.

Correct.

> Then, does anything there use thread-local storage or write to
> global data structures?  The reason I'm asking is that I don't
> understand why I can't use one library from different threads, even
> if I can guarantee that I'm not using it from different threads *at
> the same time*.  But maybe we're just misunderstanding each other.

If you can guarantee that you don't render multiple glyphs at the same
time in parallel, one FT_Library object for all threads certainly
works.  But this is something which I won't call thread-safe (please
correct me if I'm mixing up definitions).

>> So a program with multiple threads should use `FT_New_Library' and
>> `FT_Done_Library' (instead of `FT_Init_FreeType' and
>> `FT_Done_FreeType'), providing its own FT_Memory object.
> 
> Okay...?  I must admit that I don't fully understand this part of
> your answer yet, probably because I don't understand FreeType's
> structure enough.  It seems that this also influences my other
> approaches above, I'll have to verify that.

`With multiple threads' implies parallel access of FreeType.  I would
be glad if you could formulate this better!


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]