summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/hash.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-16 08:21:38 -0700
committerBrian Paul <brianp@vmware.com>2010-02-16 08:21:38 -0700
commit107a2ec9eef53dee038c1bcc0d956c5667e0b68f (patch)
tree46b293cc595c15d73792ebf887d02e78f73767c4 /src/mesa/main/hash.c
parent693f4af63dd98b963e91259029cc0131b791721c (diff)
downloadexternal_mesa3d-107a2ec9eef53dee038c1bcc0d956c5667e0b68f.zip
external_mesa3d-107a2ec9eef53dee038c1bcc0d956c5667e0b68f.tar.gz
external_mesa3d-107a2ec9eef53dee038c1bcc0d956c5667e0b68f.tar.bz2
mesa: Lock mutex around _mesa_HashLookup linked list chase.
Remove const qualifier from _mesa_HashLookup() table parameter to avoid LOCK/UNLOCK warnings in the function body. Signed-off-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 3094adb3caeb90124359db2356df3bf8ee94800a)
Diffstat (limited to 'src/mesa/main/hash.c')
-rw-r--r--src/mesa/main/hash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 7c3c7a6..fdfbe6b 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -128,7 +128,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
* \return pointer to user's data or NULL if key not in table
*/
void *
-_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
+_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
{
GLuint pos;
const struct HashEntry *entry;
@@ -137,13 +137,16 @@ _mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
assert(key);
pos = HASH_FUNC(key);
+ _glthread_LOCK_MUTEX(table->Mutex);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
- return entry->Data;
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return entry->Data;
}
entry = entry->Next;
}
+ _glthread_UNLOCK_MUTEX(table->Mutex);
return NULL;
}