public void Add(IntPtr handle) {
lock(this) {
int hash = ComputeHash(handle);
if (CompModSwitches.HandleLeak.Level >= TraceLevel.Info) {
Debug.WriteLine("-------------------------------------------------");
Debug.WriteLine("Handle Allocating: " + Convert.ToString((int)handle, 16));
Debug.WriteLine("Handle Type : " + name);
if (CompModSwitches.HandleLeak.Level >= TraceLevel.Verbose)
Debug.WriteLine(Environment.StackTrace);
}
HandleEntry entry = buckets[hash];
while (entry != null) {
Debug.Assert(entry.handle != handle, "Duplicate handle of type " + name);
entry = entry.next;
}
buckets[hash] = new HandleEntry(buckets[hash], handle);
handleCount++;
}
}