public bool WaitForAck2(PredefinedCommands.Ack2 ack2, uint miliseconds) { checkAgain: if (_completed) return false; if (_list.Contains(ack2, _comparer)) { _list.Remove(ack2); return true; } else { if (_event.WaitOne((int)miliseconds, false)) { // Ok goto checkAgain; } else { // Timeout return false; } } }
public void Add(PredefinedCommands.Ack2 ack2) { _list.Add(ack2); _event.Set(); }