internal void ResetInIDTable(bool bResetURI)
{
BCLDebug.Assert(IdentityHolder.TableLock.IsWriterLockHeld, "IDTable should be write-locked");
while(true) {
int currentFlags = _flags;
int newFlags = _flags & (~IDFLG_IN_IDTABLE);
if(currentFlags == Interlocked.CompareExchange(ref _flags, newFlags, currentFlags))
break;
}
// bResetURI is true for the external API call to Disconnect, it is
// false otherwise. Thus when a user Disconnects an object
// its URI will get reset but if lifetime service times it out
// it will not clear out the URIs
if (bResetURI)
{
((ObjRef)_objRef).URI = null;
_ObjURI = null;
}
}