-/*
- * ghashtable.c: Hashtable implementation
+/**
+ * \file
+ * Hashtable implementation
*
* Author:
* Miguel de Icaza (miguel@novell.com)
#include "metadata/gc-internals.h"
#include <mono/utils/checked-build.h>
#include <mono/utils/mono-threads-coop.h>
+#include <mono/utils/unlocked.h>
-int mono_g_hash_table_max_chain_length;
+gint32 mono_g_hash_table_max_chain_length;
#ifdef HAVE_BOEHM_GC
#define mg_new0(type,n) ((type *) GC_MALLOC(sizeof(type) * (n)))
}
}
- if (i > start && (i - start) > mono_g_hash_table_max_chain_length)
- mono_g_hash_table_max_chain_length = i - start;
- else if (i < start && (hash->table_size - (start - i)) > mono_g_hash_table_max_chain_length)
- mono_g_hash_table_max_chain_length = hash->table_size - (start - i);
+ gint32 max_length = UnlockedRead (&mono_g_hash_table_max_chain_length);
+ if (i > start && (i - start) > max_length)
+ UnlockedWrite (&mono_g_hash_table_max_chain_length, i - start);
+ else if (i < start && (hash->table_size - (start - i)) > max_length)
+ UnlockedWrite (&mono_g_hash_table_max_chain_length, hash->table_size - (start - i));
+
return i;
}
mg_free (old_values);
}
+/**
+ * mono_g_hash_table_size:
+ */
guint
mono_g_hash_table_size (MonoGHashTable *hash)
{
return hash->in_use;
}
+/**
+ * mono_g_hash_table_lookup:
+ */
gpointer
mono_g_hash_table_lookup (MonoGHashTable *hash, gconstpointer key)
{
return NULL;
}
+/**
+ * mono_g_hash_table_lookup_extended:
+ */
gboolean
mono_g_hash_table_lookup_extended (MonoGHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
{
return FALSE;
}
+/**
+ * mono_g_hash_table_foreach:
+ */
void
mono_g_hash_table_foreach (MonoGHashTable *hash, GHFunc func, gpointer user_data)
{
return NULL;
}
+/**
+ * mono_g_hash_table_remove:
+ */
gboolean
mono_g_hash_table_remove (MonoGHashTable *hash, gconstpointer key)
{
return TRUE;
}
+/**
+ * mono_g_hash_table_foreach_remove:
+ */
guint
mono_g_hash_table_foreach_remove (MonoGHashTable *hash, GHRFunc func, gpointer user_data)
{
return count;
}
+/**
+ * mono_g_hash_table_destroy:
+ */
void
mono_g_hash_table_destroy (MonoGHashTable *hash)
{
}
}
+/**
+ * mono_g_hash_table_insert:
+ */
void
mono_g_hash_table_insert (MonoGHashTable *h, gpointer k, gpointer v)
{
mono_g_hash_table_insert_replace (h, k, v, FALSE);
}
+/**
+ * mono_g_hash_table_replace:
+ */
void
mono_g_hash_table_replace(MonoGHashTable *h, gpointer k, gpointer v)
{