public void EnterReadLock()
{
ClientSpinWait sw = new ClientSpinWait();
do
{
while ((rwlock & (RwWrite | RwWait)) > 0)
{
sw.SpinOnce();
}
if ((ClientInterlocked.Add(ref rwlock, RwRead) & (RwWait | RwWait)) == 0)
{
return;
}
ClientInterlocked.Add(ref rwlock, -RwRead);
} while (true);
}