diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2008-08-22 07:20:04 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2008-08-22 07:20:04 +0000 |
commit | 3b4ce828245be692017fd1fb498952e3c4238074 (patch) | |
tree | c5e5a261d23425d336f8a5aaae3b23166e3cec01 /pango/pangox-fontcache.c | |
parent | d8b4b188b676b9cdb3f33a599fc2a77051c6938c (diff) | |
download | pango-3b4ce828245be692017fd1fb498952e3c4238074.tar.gz |
Use atomic reference counting.
2008-08-22 Behdad Esfahbod <behdad@gnome.org>
* pango/fonts.c (pango_font_metrics_ref),
(pango_font_metrics_unref):
* pango/pango-attributes.c (pango_attr_list_ref),
(pango_attr_list_unref):
* pango/pango-coverage.c (pango_coverage_ref),
(pango_coverage_unref):
* pango/pango-layout.c (pango_layout_line_ref),
(pango_layout_line_unref):
* pango/pangowin32-fontcache.c (cache_entry_unref),
(pango_win32_font_cache_loadw):
* pango/pangox-fontcache.c (cache_entry_unref),
(pango_x_font_cache_load):
Use atomic reference counting.
Pango may not be thread safe yet, but fixing it little by little
is easier than doing all in one round.
svn path=/trunk/; revision=2705
Diffstat (limited to 'pango/pangox-fontcache.c')
-rw-r--r-- | pango/pangox-fontcache.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c index a56fe737..c1177b8b 100644 --- a/pango/pangox-fontcache.c +++ b/pango/pangox-fontcache.c @@ -118,8 +118,7 @@ pango_x_font_cache_new (Display *display) static void cache_entry_unref (PangoXFontCache *cache, CacheEntry *entry) { - entry->ref_count--; - if (entry->ref_count == 0) + if (g_atomic_int_dec_and_test (&entry->ref_count)) { g_hash_table_remove (cache->forward, entry->xlfd); g_hash_table_remove (cache->back, entry->fs); @@ -154,7 +153,7 @@ pango_x_font_cache_load (PangoXFontCache *cache, if (entry) { - entry->ref_count++; + g_atomic_int_inc (&entry->ref_count); } else { @@ -200,7 +199,7 @@ pango_x_font_cache_load (PangoXFontCache *cache, } else { - entry->ref_count++; + g_atomic_int_inc (&entry->ref_count); /* Insert into the mru list */ |