Esempio n. 1
0
        private static void Produce(IRingBuffer <int> buffer, ref bool shouldStop)
        {
            Thread.Sleep(500);
            int i = 0;

            while (i <= 100)
            {
                if (!buffer.IsFull())
                {
                    // Console.WriteLine("Produce data [{0}] Thread[{1}]", i, Thread.CurrentThread.Name);
                    Thread.Sleep(500);
                    buffer.Enqueue(i++);
                }
            }
            shouldStop = true;
        }