Пример #1
0
        private async void AsyncCommandHandlerLoop()
        {
            while (true)
            {
                lock (asyncCommandQueue)
                {
                    if (asyncCommandQueue.Count > 0)
                    {
                        commandContainer = asyncCommandQueue.Dequeue();
                    }
                }
                if (commandContainer != null)
                {
                    await commandContainer.Execute();

                    commandContainer = null;
                }
                else
                {
                    Thread.Sleep(sleep);
                }
            }
        }