summaryrefslogtreecommitdiffstats
path: root/list.h
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-11-18 22:17:58 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-11-18 22:17:58 +0100
commit529df9922d85574828d95020eebcd228ba3a8164 (patch)
tree8524b46dd4bbbd163d4ce273ea6e82edd7c4b947 /list.h
parenteb208d36d466a1725e20e0a7aef39b1114b99e78 (diff)
parent7c18c6353904f8c6e7f4eab3d13c985761ab80e5 (diff)
downloadopenvpn-529df9922d85574828d95020eebcd228ba3a8164.tar.gz
openvpn-529df9922d85574828d95020eebcd228ba3a8164.tar.xz
openvpn-529df9922d85574828d95020eebcd228ba3a8164.zip
Merge branch 'feat_misc' into beta2.2
Conflicts: acinclude.m4 config-win32.h configure.ac misc.c thread.c thread.h - These conflicts was mainly due to feat_misc getting old and mostly caused by the pthread clean-up patches in feat_misc Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'list.h')
-rw-r--r--list.h33
1 files changed, 4 insertions, 29 deletions
diff --git a/list.h b/list.h
index d72751b..adde36b 100644
--- a/list.h
+++ b/list.h
@@ -40,7 +40,6 @@
/*#define LIST_TEST*/
#include "basic.h"
-#include "thread.h"
#include "buffer.h"
#define hashsize(n) ((uint32_t)1<<(n))
@@ -56,7 +55,6 @@ struct hash_element
struct hash_bucket
{
- MUTEX_DEFINE (mutex);
struct hash_element *list;
};
@@ -90,7 +88,7 @@ bool hash_remove_fast (struct hash *hash,
const void *key,
uint32_t hv);
-void hash_remove_by_value (struct hash *hash, void *value, bool autolock);
+void hash_remove_by_value (struct hash *hash, void *value);
struct hash_iterator
{
@@ -100,18 +98,16 @@ struct hash_iterator
struct hash_element *elem;
struct hash_element *last;
bool bucket_marked;
- bool autolock;
int bucket_index_start;
int bucket_index_end;
};
void hash_iterator_init_range (struct hash *hash,
struct hash_iterator *hi,
- bool autolock,
int start_bucket,
int end_bucket);
-void hash_iterator_init (struct hash *hash, struct hash_iterator *iter, bool autolock);
+void hash_iterator_init (struct hash *hash, struct hash_iterator *iter);
struct hash_element *hash_iterator_next (struct hash_iterator *hi);
void hash_iterator_delete_element (struct hash_iterator *hi);
void hash_iterator_free (struct hash_iterator *hi);
@@ -149,40 +145,21 @@ hash_bucket (struct hash *hash, uint32_t hv)
return &hash->buckets[hv & hash->mask];
}
-static inline void
-hash_bucket_lock (struct hash_bucket *bucket)
-{
- mutex_lock (&bucket->mutex);
-}
-
-static inline void
-hash_bucket_unlock (struct hash_bucket *bucket)
-{
- mutex_unlock (&bucket->mutex);
-}
-
static inline void *
-hash_lookup_lock (struct hash *hash, const void *key, uint32_t hv)
+hash_lookup (struct hash *hash, const void *key)
{
void *ret = NULL;
struct hash_element *he;
+ uint32_t hv = hash_value (hash, key);
struct hash_bucket *bucket = &hash->buckets[hv & hash->mask];
- mutex_lock (&bucket->mutex);
he = hash_lookup_fast (hash, bucket, key, hv);
if (he)
ret = he->value;
- mutex_unlock (&bucket->mutex);
return ret;
}
-static inline void *
-hash_lookup (struct hash *hash, const void *key)
-{
- return hash_lookup_lock (hash, key, hash_value (hash, key));
-}
-
/* NOTE: assumes that key is not a duplicate */
static inline void
hash_add_fast (struct hash *hash,
@@ -211,9 +188,7 @@ hash_remove (struct hash *hash, const void *key)
hv = hash_value (hash, key);
bucket = &hash->buckets[hv & hash->mask];
- mutex_lock (&bucket->mutex);
ret = hash_remove_fast (hash, bucket, key, hv);
- mutex_unlock (&bucket->mutex);
return ret;
}