Merge origin/master into master
This commit is contained in:
+16
-5
@@ -271,15 +271,26 @@ TEST_CASE("a second sentinel is refused, not swallowed", "[channel][sentinel]")
|
||||
CHECK(out == 3);
|
||||
}
|
||||
|
||||
TEST_CASE("a refused sentinel is counted as a drop", "[channel][sentinel]") {
|
||||
// Visibility matters more here than for a dropped value: the refusal means
|
||||
// a control token went nowhere, and the only alternative to a counter is
|
||||
// for it to vanish.
|
||||
TEST_CASE("a refused sentinel is not counted as a drop", "[channel][sentinel]") {
|
||||
// A refusal means a token arrived while an equivalent one was already
|
||||
// pending — not that anything was lost. Counting it as a drop was wrong in
|
||||
// a way that showed up immediately on real content: a source at the end of
|
||||
// its input keeps being polled and keeps returning EOF, so the token is
|
||||
// re-offered on every firing, and the pipeline reported hundreds of dropped
|
||||
// frames on a clean run and exited non-zero.
|
||||
//
|
||||
// The delivery guarantee is unaffected: the first token is pending and will
|
||||
// arrive. Only the accounting changed.
|
||||
Channel<int> ch(4);
|
||||
REQUIRE(ch.push_sentinel(1));
|
||||
const auto before = ch.stats().drops.load();
|
||||
REQUIRE_FALSE(ch.push_sentinel(2));
|
||||
CHECK(ch.stats().drops.load() == before + 1);
|
||||
CHECK(ch.stats().drops.load() == before);
|
||||
|
||||
// And the one that was accepted is still the one delivered.
|
||||
int out = 0;
|
||||
REQUIRE(ch.try_pop_now(out));
|
||||
CHECK(out == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("try_push_sentinel leaves a refused value untouched", "[channel][sentinel]") {
|
||||
|
||||
Reference in New Issue
Block a user