Exemple #1
0
            public SynchronizedAsyncResult(SynchronizedMessageSource syncSource, TimeSpan timeout,
                                           AsyncCallback callback, object state)
                : base(callback, state)
            {
                this.syncSource    = syncSource;
                this.timeoutHelper = new TimeoutHelper(timeout);

                if (!syncSource.sourceLock.EnterAsync(this.timeoutHelper.RemainingTime(), onEnterComplete, this))
                {
                    return;
                }

                exitLock = true;
                bool success = false;
                bool completeSelf;

                try
                {
                    completeSelf = PerformOperation(timeoutHelper.RemainingTime());
                    success      = true;
                }
                finally
                {
                    if (!success)
                    {
                        ExitLock();
                    }
                }
                if (completeSelf)
                {
                    CompleteWithUnlock(true);
                }
            }
Exemple #2
0
 public SynchronizedAsyncResult(SynchronizedMessageSource syncSource, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.syncSource    = syncSource;
     this.timeoutHelper = new TimeoutHelper(timeout);
     if (syncSource.sourceLock.EnterAsync(this.timeoutHelper.RemainingTime(), SynchronizedMessageSource.SynchronizedAsyncResult <T> .onEnterComplete, this))
     {
         bool flag2;
         this.exitLock = true;
         bool flag = false;
         try
         {
             flag2 = this.PerformOperation(this.timeoutHelper.RemainingTime());
             flag  = true;
         }
         finally
         {
             if (!flag)
             {
                 this.ExitLock();
             }
         }
         if (flag2)
         {
             this.CompleteWithUnlock(true);
         }
     }
 }
Exemple #3
0
 public WaitForMessageAsyncResult(SynchronizedMessageSource syncSource, TimeSpan timeout,
                                  AsyncCallback callback, object state)
     : base(syncSource, timeout, callback, state)
 {
 }
 protected void SetMessageSource(IMessageSource messageSource)
 {
     _messageSource = new SynchronizedMessageSource(messageSource);
 }
Exemple #5
0
 protected void SetMessageSource(IMessageSource messageSource)
 {
     MessageSource = new SynchronizedMessageSource(messageSource);
 }