private void process() { while (true) { if (pool_messages.Count > 0) { ConsoleMessageItem activeItem = pool_messages.Dequeue(); Console.WriteLine("[Message:" + activeItem.Message + " ]"); if (pool_messages.Count > 0) { continue; } } Thread.Sleep(200); } }
public void set_newMessage(ConsoleMessageItem newItem) { pool_messages.Enqueue(newItem); }