public void Release (System.Object o) {
if (o == null) throw new System.ArgumentNullException ("o");
for (int i=0;i<claimed.Count;i++) {
// Need to use ReferenceEquals because it might be called from another thread
if (System.Object.ReferenceEquals (claimed[i], o)) {
claimed.RemoveAt (i);
#if ASTAR_POOL_DEBUG
claimInfo.RemoveAt (i);
#endif
releasedNotSilent = true;
if (claimed.Count == 0) {
Recycle ();
}
return;
}
}
if (claimed.Count == 0) {
throw new System.ArgumentException ("You are releasing a path which is not claimed at all (most likely it has been pooled already). " +
"Are you releasing the path with the same object ("+o+") twice?");
}
throw new System.ArgumentException ("You are releasing a path which has not been claimed with this object ("+o+"). " +
"Are you releasing the path with the same object twice?");
}