diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-08-11 22:52:07 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-08-11 22:52:07 +0300 |
commit | d2b1e4712dc16a18862d6c3bd46c68caea2511e7 (patch) | |
tree | 9fa47c51c89fc72d6fc726fff2f281f4eef37102 /source/blender/blenfont/intern/blf_glyph.c | |
parent | 2fc7e15164fc615045c2ff67eb823282b6c43abd (diff) |
BLF: Mutex Lock Glyph Cache Per Font, Not Global
Only lock access to our glyph caches per-font, rather than globally.
Also upgrade from spinlocks to mutexes.
See D15644 for more details.
Differential Revision: https://developer.blender.org/D15644
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont/intern/blf_glyph.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 9cdca81af28..f938174f92e 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -115,7 +115,7 @@ static GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font) GlyphCacheBLF *blf_glyph_cache_acquire(FontBLF *font) { - BLI_spin_lock(font->glyph_cache_mutex); + BLI_mutex_lock(&font->glyph_cache_mutex); GlyphCacheBLF *gc = blf_glyph_cache_find(font, font->size, font->dpi); @@ -128,7 +128,7 @@ GlyphCacheBLF *blf_glyph_cache_acquire(FontBLF *font) void blf_glyph_cache_release(FontBLF *font) { - BLI_spin_unlock(font->glyph_cache_mutex); + BLI_mutex_unlock(&font->glyph_cache_mutex); } static void blf_glyph_cache_free(GlyphCacheBLF *gc) @@ -152,13 +152,13 @@ void blf_glyph_cache_clear(FontBLF *font) { GlyphCacheBLF *gc; - BLI_spin_lock(font->glyph_cache_mutex); + BLI_mutex_lock(&font->glyph_cache_mutex); while ((gc = BLI_pophead(&font->cache))) { blf_glyph_cache_free(gc); } - BLI_spin_unlock(font->glyph_cache_mutex); + BLI_mutex_unlock(&font->glyph_cache_mutex); } /** |