summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/hash.c
diff options
context:
space:
mode:
authorThomas Helland <[email protected]>2017-05-18 20:39:20 +0200
committerTimothy Arceri <[email protected]>2017-05-22 09:17:37 +1000
commitf203a9f7d1a7fc4cf41b35a477eb1f3699418fe3 (patch)
treefa859ac4fc5b14d6717597c2a3408a6d749cb263 /src/mesa/main/hash.c
parent90dfcc6b32c5a635d30cd04fc887a7ff78d3476d (diff)
main: Use _mesa_HashLock/UnlockMutex consistently
This is shorter and easier on the eyes. At the same time this also ensures that we are always asserting that the table pointer is not NULL. Currently that was not done for all situations. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/hash.c')
-rw-r--r--src/mesa/main/hash.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 5b9132a3115..e352a46aa4b 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -205,10 +205,9 @@ void *
_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
{
void *res;
- assert(table);
- mtx_lock(&table->Mutex);
+ _mesa_HashLockMutex(table);
res = _mesa_HashLookup_unlocked(table, key);
- mtx_unlock(&table->Mutex);
+ _mesa_HashUnlockMutex(table);
return res;
}
@@ -315,10 +314,9 @@ _mesa_HashInsertLocked(struct _mesa_HashTable *table, GLuint key, void *data)
void
_mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
{
- assert(table);
- mtx_lock(&table->Mutex);
+ _mesa_HashLockMutex(table);
_mesa_HashInsert_unlocked(table, key, data);
- mtx_unlock(&table->Mutex);
+ _mesa_HashUnlockMutex(table);
}
@@ -364,9 +362,9 @@ _mesa_HashRemoveLocked(struct _mesa_HashTable *table, GLuint key)
void
_mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
{
- mtx_lock(&table->Mutex);
+ _mesa_HashLockMutex(table);
_mesa_HashRemove_unlocked(table, key);
- mtx_unlock(&table->Mutex);
+ _mesa_HashUnlockMutex(table);
}
/**
@@ -385,9 +383,8 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
{
struct hash_entry *entry;
- assert(table);
assert(callback);
- mtx_lock(&table->Mutex);
+ _mesa_HashLockMutex(table);
table->InDeleteAll = GL_TRUE;
hash_table_foreach(table->ht, entry) {
callback((uintptr_t)entry->key, entry->data, userData);
@@ -398,7 +395,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
table->deleted_key_data = NULL;
}
table->InDeleteAll = GL_FALSE;
- mtx_unlock(&table->Mutex);
+ _mesa_HashUnlockMutex(table);
}
@@ -434,9 +431,9 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
/* cast-away const */
struct _mesa_HashTable *table2 = (struct _mesa_HashTable *) table;
- mtx_lock(&table2->Mutex);
+ _mesa_HashLockMutex(table2);
hash_walk_unlocked(table, callback, userData);
- mtx_unlock(&table2->Mutex);
+ _mesa_HashUnlockMutex(table2);
}
void