Ejemplo n.º 1
0
 public void EndRead()
 {
     Monitor.Enter(this);
     readerCount--;
     Monitor.PulseAll(this);
     Monitor.Exit(this);
 }
Ejemplo n.º 2
0
        public void EndWrite()
        {
            Monitor.Enter(this);
            writerCount--;
#if DEBUG_THREADS
            writeLockHolder = null;
#endif
            Monitor.PulseAll(this);
            Monitor.Exit(this);
        }
Ejemplo n.º 3
0
 public void BeginRead()
 {
     Monitor.Enter(this);
     while (writerCount != 0 || writersWaiting != 0)
     {
         Monitor.Wait(this);
     }
     readerCount++;
     Monitor.Exit(this);
 }
Ejemplo n.º 4
0
        public void BeginWrite()
        {
            Monitor.Enter(this);
            writersWaiting++;
            while (readerCount != 0 || writerCount != 0)
            {
                Monitor.Wait(this);
            }
            writersWaiting--;
            writerCount++;
#if DEBUG_THREADS
            writeLockHolder = new StackTrace(true);
#endif
            Monitor.Exit(this);
        }