Esempio n. 1
0
            public bool Wait(TimeSpan timeout)
            {
                if (!TimeoutHelper.WaitOne(_waitEvent, timeout))
                {
                    return(false);
                }

                return(_itemAvailable);
            }
Esempio n. 2
0
 public bool Wait(TimeSpan timeout)
 {
     if (TimeoutHelper.WaitOne(this.waitEvent, timeout))
     {
         return(this.itemAvailable);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
            public bool Wait(TimeSpan timeout, out T value)
            {
                bool flag;
                bool flag1 = false;

                try
                {
                    if (!TimeoutHelper.WaitOne(this.waitEvent, timeout))
                    {
                        if (!this.inputQueue.RemoveReader(this))
                        {
                            this.waitEvent.WaitOne();
                        }
                        else
                        {
                            value = default(T);
                            flag1 = true;
                            flag  = false;
                            return(flag);
                        }
                    }
                    flag1 = true;
                    goto Label0;
                }
                finally
                {
                    if (flag1)
                    {
                        this.waitEvent.Close();
                    }
                }
                return(flag);

Label0:
                if (this.exception == null)
                {
                    value = this.item;
                    return(true);
                }
                else
                {
                    throw Fx.Exception.AsError(this.exception);
                }
            }
Esempio n. 4
0
            public bool Wait(TimeSpan timeout, out T value)
            {
                bool isSafeToClose = false;

                try
                {
                    if (!TimeoutHelper.WaitOne(_waitEvent, timeout))
                    {
                        if (_inputQueue.RemoveReader(this))
                        {
                            value         = default(T);
                            isSafeToClose = true;
                            return(false);
                        }
                        else
                        {
                            _waitEvent.WaitOne();
                        }
                    }

                    isSafeToClose = true;
                }
                finally
                {
                    if (isSafeToClose)
                    {
                        _waitEvent.Dispose();
                    }
                }

                if (_exception != null)
                {
                    throw Fx.Exception.AsError(_exception);
                }

                value = _item;
                return(true);
            }