private static Exception WaitFor(AtomicReference <Exception> reference) { while (reference.Read() == null) { Thread.Yield(); } return(reference.Read()); }