예제 #1
0
 private static void DoSomeWriting()
 {
     while (true)
     {
         _testReadWriteLock.AcquireWriter();
         Console.WriteLine("\t\t" + Thread.CurrentThread.Name + ": Yeah! I'm writing some stuff!");
         Thread.Sleep(new Random().Next(1000, 1500));
         Console.WriteLine("\t\t\t" + Thread.CurrentThread.Name + ": Well, I'm done writing.");
         _testReadWriteLock.ReleaseWriter();
     }
 }