/// <summary> /// Creates tuples in non-greedy mode, /// making sure the whole tuple is available by using reservations. /// </summary> void NonGreedyProcess() { while (ShouldProcessNonGreedy()) { var reservation1 = target1.ReserveMessage(); if (reservation1 == null) { break; } var reservation2 = target2.ReserveMessage(); if (reservation2 == null) { target1.RelaseReservation(reservation1); break; } var value1 = target1.ConsumeReserved(reservation1); var value2 = target2.ConsumeReserved(reservation2); TriggerMessage(value1, value2); } nonGreedyProcessing.Value = false; if (ShouldProcessNonGreedy()) { EnsureNonGreedyProcessing(); } }