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