Esempio n. 1
0
        public virtual T DequeueFromInput(bool isPeek, bool useTimeout = false)
        {
            sw = DateTime.Now;
            T qItem = default(T);

            while (1 == 1)
            {
                if (useTimeout)
                {
                    if ((DateTime.Now - sw).TotalMilliseconds > timeoutMS)
                    {
                        break;
                    }
                }

                if (InQ.Count == 0)
                {
                    Task.Run(async() => await Task.Delay(waitTimeMS)).Wait();
                    continue;
                }

                if (isPeek)
                {
                    if (!InQ.TryPeek(out qItem))
                    {
                        Task.Run(async() => await Task.Delay(waitTimeMS)).Wait();
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    if (!InQ.TryDequeue(out qItem))
                    {
                        Task.Run(async() => await Task.Delay(waitTimeMS)).Wait();
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return(qItem);
        }
 public OutQ Query(InQ inQ)
 {
     return new OutQ();
 }
Esempio n. 3
0
 public virtual void EnqueueToInput(T message)
 {
     InQ.Enqueue(message);
 }
Esempio n. 4
0
 public OutQ Query(InQ inQ)
 {
     return(new OutQ());
 }