static void PutThenPick(LIFOQueue queue) { for (int i = 0; i < 100; i++) { queue.Put(i); queue.Pick(); } Console.WriteLine("ready"); }
static void Main(string[] args) { int theNumber = 0; var queue = new LIFOQueue(100); ThreadPool.QueueUserWorkItem((o) => PutThenPick(queue)); ThreadPool.QueueUserWorkItem((o) => PutThenPick(queue)); ThreadPool.QueueUserWorkItem((o) => PutThenPick(queue)); Thread.Sleep(1000); Console.ReadLine(); }