Example #1
0
 public static void Main() {
    
    SyncQueue queue = new SyncQueue();
    
    Thread p1 = new Thread(() => {
       for (int i = 0; i < 1024; ++i) {
          queue.Put(new Object());
       }
    });
    
    Thread c1 = new Thread(() => {
       for (int i = 0; i < 1024; ++i) {
          queue.Take();
       }
    });
    
    c1.Start();
    p1.Start();
    
    p1.Join();
    c1.Join();
    
    Console.WriteLine("OK");
 }