* While holding the hash table's lock, searches the entry with the matching
* key and unlinks it.
*/
-void
-_mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
+static inline void
+_mesa_HashRemove_unlocked(struct _mesa_HashTable *table, GLuint key)
{
struct hash_entry *entry;
return;
}
- mtx_lock(&table->Mutex);
if (key == DELETED_KEY_VALUE) {
table->deleted_key_data = NULL;
} else {
entry = _mesa_hash_table_search(table->ht, uint_key(key));
_mesa_hash_table_remove(table->ht, entry);
}
- mtx_unlock(&table->Mutex);
}
+void
+_mesa_HashRemoveLocked(struct _mesa_HashTable *table, GLuint key)
+{
+ _mesa_HashRemove_unlocked(table, key);
+}
+
+void
+_mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
+{
+ mtx_lock(&table->Mutex);
+ _mesa_HashRemove_unlocked(table, key);
+ mtx_unlock(&table->Mutex);
+}
/**
* Delete all entries in a hash table, but don't delete the table itself.
extern void _mesa_HashInsertLocked(struct _mesa_HashTable *table,
GLuint key, void *data);
+extern void _mesa_HashRemoveLocked(struct _mesa_HashTable *table, GLuint key);
+
extern void
_mesa_HashDeleteAll(struct _mesa_HashTable *table,
void (*callback)(GLuint key, void *data, void *userData),