public bool WaitForDone(int timeout) { while (true) { if (!AsyncWaitHandle.WaitOne(timeout)) return false; if (Segmented) ((System.Threading.ManualResetEvent)AsyncWaitHandle).Reset(); else return true; } }