1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00
JUCE/modules/juce_graphics/fonts
reuk 3768349a05
Font: Make Font and TypefaceCache threadsafe
Previously, it wasn't safe to access Font instances from multiple
threads because there was a chance that they might reference the same
shared internal state. In this case, calling getTypeface() or getAscent from
two threads simultaneously would cause a race on the typeface and ascent
data members, even though the Font instances appeared to be disjoint.

With this change in place, it is now safe to use Font instances from
multiple threads simultaneously.

It is still an error to modify the same Font instance from multiple
threads without synchronization!

    // Fine:
    Font a;
    Font b = a;

    auto futureA = std::async (std::launch::async, [&a] { /* do something with a */ });
    auto futureB = std::async (std::launch::async, [&b] { /* do something with b */ });

    // Bad idea:
    Font f;

    auto futureA = std::async (std::launch::async, [&f] { /* do something with f */ });
    auto futureB = std::async (std::launch::async, [&f] { /* do something with f */ });
2021-09-23 10:28:47 +01:00
..
juce_AttributedString.cpp Updated all license headers 2020-06-29 08:30:22 +01:00
juce_AttributedString.h Updated all license headers 2020-06-29 08:30:22 +01:00
juce_CustomTypeface.cpp Updated all license headers 2020-06-29 08:30:22 +01:00
juce_CustomTypeface.h Updated all license headers 2020-06-29 08:30:22 +01:00
juce_Font.cpp Font: Make Font and TypefaceCache threadsafe 2021-09-23 10:28:47 +01:00
juce_Font.h Font: Make Font and TypefaceCache threadsafe 2021-09-23 10:28:47 +01:00
juce_GlyphArrangement.cpp Font: Make Font and TypefaceCache threadsafe 2021-09-23 10:28:47 +01:00
juce_GlyphArrangement.h Updated all license headers 2020-06-29 08:30:22 +01:00
juce_TextLayout.cpp TextLayout: Ensure that line origin is set correctly when line starts with whitespace or newline glyphs 2021-09-02 08:35:14 +01:00
juce_TextLayout.h TextLayout: Tidy up special member functions 2021-07-05 12:21:36 +01:00
juce_Typeface.cpp Font: Make Font and TypefaceCache threadsafe 2021-09-23 10:28:47 +01:00
juce_Typeface.h Updated all license headers 2020-06-29 08:30:22 +01:00