Пример #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
                }
            }
        }
Пример #2
0
 public CatchingRunnable(IForkState forkState, Runnable runnable, CountDownLatch latch, IParamHolder <Exception> throwableHolder,
                         IThreadLocalCleanupController threadLocalCleanupController)
 {
     this.forkState       = forkState;
     this.runnable        = runnable;
     this.latch           = latch;
     this.throwableHolder = throwableHolder;
     this.threadLocalCleanupController = threadLocalCleanupController;
 }