BettingBot.Source.Common.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop C# (CSharp) Method

BeginMessageLoop() public method

public BeginMessageLoop ( ) : void
return void
            public void BeginMessageLoop()
            {
                while (!done)
                {
                    Tuple<SendOrPostCallback, object> task = null;
                    lock (items)
                    {
                        if (items.Count > 0)
                        {
                            task = items.Dequeue();
                        }
                    }
                    if (task != null)
                    {
                        task.Item1(task.Item2);
                        if (InnerException != null) // the method threw an exeption
                        {
                            throw new AggregateException("AsyncHelpers.Run method threw an exception.", InnerException);
                        }
                    }
                    else
                    {
                        workItemsWaiting.WaitOne();
                    }
                }
            }
AsyncHelpers.ExclusiveSynchronizationContext