summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2010-03-30 12:01:31 +0200
committerMichel Dänzer <daenzer@vmware.com>2010-03-30 12:01:31 +0200
commite5c7d1e1c8ccb493c63e33d017c28b5cf4a55829 (patch)
tree0c73ae897b0cfb09ad21e13e27f45bb11b82e75b /src/mesa
parentaa1a79036003c2aeaae24877da66e9b46a059cad (diff)
parent07c6d94cd7272524ef06b2a787667e5d626137d2 (diff)
Merge branch '7.8'
Conflicts: Makefile src/mesa/main/version.h Resolved by keeping version strings from master (also in the intel driver).
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/hash.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 975775469d..b624e6ecac 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -120,15 +120,11 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
/**
- * Lookup an entry in the hash table.
- *
- * \param table the hash table.
- * \param key the key.
- *
- * \return pointer to user's data or NULL if key not in table
+ * Lookup an entry in the hash table, without locking.
+ * \sa _mesa_HashLookup
*/
-void *
-_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
+static INLINE void *
+_mesa_HashLookup_unlocked(struct _mesa_HashTable *table, GLuint key)
{
GLuint pos;
const struct HashEntry *entry;
@@ -137,20 +133,36 @@ _mesa_HashLookup(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) {
- _glthread_UNLOCK_MUTEX(table->Mutex);
return entry->Data;
}
entry = entry->Next;
}
- _glthread_UNLOCK_MUTEX(table->Mutex);
return NULL;
}
+/**
+ * Lookup an entry in the hash table.
+ *
+ * \param table the hash table.
+ * \param key the key.
+ *
+ * \return pointer to user's data or NULL if key not in table
+ */
+void *
+_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
+{
+ void *res;
+ assert(table);
+ _glthread_LOCK_MUTEX(table->Mutex);
+ res = _mesa_HashLookup_unlocked(table, key);
+ _glthread_UNLOCK_MUTEX(table->Mutex);
+ return res;
+}
+
/**
* Insert a key/pointer pair into the hash table.
@@ -447,7 +459,7 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
GLuint freeStart = 1;
GLuint key;
for (key = 1; key != maxKey; key++) {
- if (_mesa_HashLookup(table, key)) {
+ if (_mesa_HashLookup_unlocked(table, key)) {
/* darn, this key is already in use */
freeCount = 0;
freeStart = key+1;