public void Run(bool completeSynchronously) { // read from delegate bufferRead.BeginInvoke(preambleBuffer, 0, preambleBuffer.Length, DoneReadingPreamble, null); if (completeSynchronously) { stopInput.WaitOne(); } }
public override IAsyncResult BeginRunPump(AsyncCallback callback, object state) { if (IsRunning) { throw new InvalidOperationException("Already running"); } IsRunning = true; Caller = new PumpAsyncResult(callback, state); bufferRead.BeginInvoke(inputBuffer, preambleSize, inputBuffer.Length - preambleSize, DoneReading, null); return(Caller); }