summaryrefslogtreecommitdiff
path: root/pango/pango-threadsafe.h
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-threadsafe.h')
-rw-r--r--pango/pango-threadsafe.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/pango/pango-threadsafe.h b/pango/pango-threadsafe.h
index cf8b4258..57e823d1 100644
--- a/pango/pango-threadsafe.h
+++ b/pango/pango-threadsafe.h
@@ -85,6 +85,23 @@ void p_hash_table_insert (PHashTable *hash_table,
}
static inline
+gboolean p_hash_table_insert_if_null (PHashTable *hash_table,
+ gpointer key,
+ gpointer value)
+{
+ gboolean ret;
+ g_mutex_lock (&hash_table->mx);
+ if (g_hash_table_lookup (hash_table->ht, key))
+ ret = FALSE;
+ else {
+ g_hash_table_insert (hash_table->ht, key, value);
+ ret = TRUE;
+ }
+ g_mutex_unlock (&hash_table->mx);
+ return ret;
+}
+
+static inline
void p_hash_table_replace (PHashTable *hash_table,
gpointer key,
gpointer value)