mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
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>
This commit is contained in:
parent
7c7247ddbf
commit
3094adb3ca
2 changed files with 6 additions and 3 deletions
|
|
@ -128,7 +128,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
|
||||||
* \return pointer to user's data or NULL if key not in table
|
* \return pointer to user's data or NULL if key not in table
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
|
_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
|
||||||
{
|
{
|
||||||
GLuint pos;
|
GLuint pos;
|
||||||
const struct HashEntry *entry;
|
const struct HashEntry *entry;
|
||||||
|
|
@ -137,13 +137,16 @@ _mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
|
||||||
assert(key);
|
assert(key);
|
||||||
|
|
||||||
pos = HASH_FUNC(key);
|
pos = HASH_FUNC(key);
|
||||||
|
_glthread_LOCK_MUTEX(table->Mutex);
|
||||||
entry = table->Table[pos];
|
entry = table->Table[pos];
|
||||||
while (entry) {
|
while (entry) {
|
||||||
if (entry->Key == key) {
|
if (entry->Key == key) {
|
||||||
return entry->Data;
|
_glthread_UNLOCK_MUTEX(table->Mutex);
|
||||||
|
return entry->Data;
|
||||||
}
|
}
|
||||||
entry = entry->Next;
|
entry = entry->Next;
|
||||||
}
|
}
|
||||||
|
_glthread_UNLOCK_MUTEX(table->Mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ extern struct _mesa_HashTable *_mesa_NewHashTable(void);
|
||||||
|
|
||||||
extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
|
extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
|
||||||
|
|
||||||
extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
|
extern void *_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key);
|
||||||
|
|
||||||
extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
|
extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue