Ejemplo n.º 1
0
 public void Wait()
 {
     this.waitHandle.WaitOne();
     this.waitHandle.Close();
     if (this.aborted)
     {
         throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(ThreadNeutralSemaphore.CreateObjectAbortedException());
     }
 }
Ejemplo n.º 2
0
            public bool Wait(TimeSpan timeout)
            {
                bool flag = true;

                if (!Microsoft.ServiceBus.Common.TimeoutHelper.WaitOne(this.waitHandle, timeout))
                {
                    if (this.parent.RemoveWaiter(this))
                    {
                        flag = false;
                    }
                    else
                    {
                        this.waitHandle.WaitOne();
                    }
                }
                this.waitHandle.Close();
                if (this.aborted)
                {
                    throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(ThreadNeutralSemaphore.CreateObjectAbortedException());
                }
                return(flag);
            }
Ejemplo n.º 3
0
 private ThreadNeutralSemaphore.SyncWaiter EnterCore()
 {
     ThreadNeutralSemaphore.SyncWaiter syncWaiter;
     lock (this.ThisLock)
     {
         if (this.aborted)
         {
             throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(ThreadNeutralSemaphore.CreateObjectAbortedException());
         }
         if (this.count >= this.maxCount)
         {
             if (this.traceOnFailureToEnter)
             {
                 this.IncrementFailureCount();
             }
             ThreadNeutralSemaphore.SyncWaiter syncWaiter1 = new ThreadNeutralSemaphore.SyncWaiter(this);
             this.Waiters.Enqueue(syncWaiter1);
             return(syncWaiter1);
         }
         else
         {
             ThreadNeutralSemaphore threadNeutralSemaphore = this;
             threadNeutralSemaphore.count = threadNeutralSemaphore.count + 1;
             syncWaiter = null;
         }
     }
     return(syncWaiter);
 }