internal void CloseAsIs()
{
RuntimeHelpers.PrepareConstrainedRegions();
try { }
finally
{
#if DEBUG
// If this throws it could be very bad.
try
{
#endif
InnerSafeCloseSocket innerSocket = m_InnerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref m_InnerSocket, null);
Close();
if (innerSocket != null)
{
// Wait until it's safe.
while (!m_Released)
{
Thread.SpinWait(1);
}
// Now free it with blocking.
innerSocket.BlockingRelease();
}
#if DEBUG
}
catch (Exception exception)
{
if (!NclUtilities.IsFatal(exception)){
GlobalLog.Assert("SafeCloseSocket::CloseAsIs(handle:" + handle.ToString("x") + ")", exception.Message);
}
throw;
}
#endif
}
}