Exemplo n.º 1
0
 private static void WaitWhileOccupied(ReadIndicator readIndicator)
 {
     while (!readIndicator.IsEmpty)
     {
         RE.Yield();
     }
 }
Exemplo n.º 2
0
 internal void EnterWriteLock()
 {
     RMonitor.Enter(_lockObj);
     RUnordered.Write(ref _writerActive, 1);
     RInterlocked.MemoryBarrierProcessWide();
     while (ReadInProgress())
     {
         RE.Yield();
     }
     _snoop.BeginWrite();
     return;
 }
Exemplo n.º 3
0
 private void EnterSlow()
 {
     RMonitor.Enter(_lockObj);
     RUnordered.Write(ref _holdingThreadId, Environment.CurrentManagedThreadId);
     RInterlocked.MemoryBarrierProcessWide();
     while (RUnordered.Read(ref _isHeld) == 1)
     {
         RE.Yield();
     }
     RUnordered.Write(ref _isHeld, 1);
     RMonitor.Exit(_lockObj);
     return;
 }
Exemplo n.º 4
0
            private LockCookie EnterSlow()
            {
                RMonitor.Enter(_lockObj);
                var oldEntry = RUnordered.Read(ref _current);

                RUnordered.Write(ref _current, new LockCookie(Environment.CurrentManagedThreadId));
                RInterlocked.MemoryBarrierProcessWide();
                while (oldEntry != null && RUnordered.Read(ref oldEntry.Taken) == 1)
                {
                    RE.Yield();
                }
                var current = RUnordered.Read(ref _current);

                RUnordered.Write(ref current.Taken, 1);
                RMonitor.Exit(_lockObj);
                return(current);
            }