static void PopTest(int n, SafeQueue <int> Queue) { for (int i = 0; i < n; i++) { Queue.Pop(); } }
static void PushTest(int n, SafeQueue <int> Queue) { Random r = new Random(); for (int i = 0; i < n; i++) { Queue.Push(r.Next(1, 100)); } }
static void Main(string[] args) { SafeQueue <int> TestQueue = new SafeQueue <int>(); Thread PushElement = new Thread(() => PopTest(20, TestQueue)); Thread PopElement = new Thread(() => PushTest(20, TestQueue)); PopElement.Start(); PushElement.Start(); Console.ReadLine(); }