Exemplo n.º 1
0
        protected void WaitForLatch(CountDownLatch latch, IParamHolder <Exception> exHolder)
        {
            while (true)
            {
                if (exHolder.Value != null)
                {
                    // A parallel exception will be thrown here

                    Exception ex = exHolder.Value;
                    throw ex;
                }
                try
                {
                    latch.Await();
                    if (latch.GetCount() == 0)
                    {
                        return;
                    }
                }
                catch (ThreadInterruptedException)
                {
                    // intended blank
                }
            }
        }
Exemplo n.º 2
0
 internal virtual void MarkComplete()
 {
     Preconditions.CheckState(completionLatch.GetCount() == 1, "Context already completed!"
                              );
     completionLatch.CountDown();
 }