private void NotifyAboutCorrelationFailure(CancellationToken token) { if (WaitHandle.WaitAny(new[] { token.WaitHandle, _frameReceived.WaitHandle }, 5000) == WaitHandle.WaitTimeout) { CorrelationFailed?.Invoke(this, EventArgs.Empty); } }
// </SnippetMultiFrameArrived> // <SnippetNotifyCorrelationFailure> private void NotifyAboutCorrelationFailure(CancellationToken token) { // If in 5 seconds the token is not cancelled and frame event is not signaled, // correlation is most likely failed. if (WaitHandle.WaitAny(new[] { token.WaitHandle, _frameReceived.WaitHandle }, 5000) == WaitHandle.WaitTimeout) { CorrelationFailed?.Invoke(this, EventArgs.Empty); } }