示例#1
0
 public static void testReentrantWriter(ReadWriteLock readWriteLock)
 {
     readWriteLock.WriteLock();
     readWriteLock.WriteLock();
     readWriteLock.WriteLock();
     readWriteLock.WriteLock();
     Console.WriteLine("Test Reentrant Writer");
     readWriteLock.WriteUnlock();
     readWriteLock.WriteUnlock();
     readWriteLock.WriteUnlock();
     readWriteLock.WriteUnlock();
 }
示例#2
0
 public static void testLock(ReadWriteLock readWriteLock)
 {
     for (int i = 0; i < 100000; i++)
     {
         readWriteLock.WriteLock();
         num++;
         readWriteLock.WriteUnlock();
     }
 }
 public static void testReentrantWriter(ReadWriteLock readWriteLock)
 {
     for (int i = 0; i < 3; i++)
     {
         readWriteLock.WriteLock();
     }
     for (int i = 0; i < 3; i++)
     {
         readWriteLock.WriteUnlock();
     }
 }
 public static void testWriter(ReadWriteLock readWriteLock)
 {
     readWriteLock.WriteLock();
     Thread.Sleep(600);
     readWriteLock.WriteUnlock();
 }