threadOnce further reduce boilerplate

also latch failure
This commit is contained in:
Michael Davidsaver
2023-09-04 11:26:32 +02:00
parent 59164a63f7
commit d7e49605cc
10 changed files with 76 additions and 59 deletions
+22 -1
View File
@@ -267,11 +267,31 @@ void testStrDiff()
"+ \" yyy\"\n");
}
size_t onceCount[2];
template<size_t I>
void onceInc() {
onceCount[I]++;
}
void testOnce()
{
testShow()<<__func__;
threadOnce<onceInc<0>>();
threadOnce<onceInc<1>>();
threadOnce<onceInc<0>>();
threadOnce<onceInc<1>>();
testEq(onceCount[0], 1u);
testEq(onceCount[1], 1u);
}
} // namespace
MAIN(testutil)
{
testPlan(33);
testPlan(35);
testTrue(version_abi_check())<<" 0x"<<std::hex<<PVXS_VERSION<<" ~= 0x"<<std::hex<<PVXS_ABI_VERSION;
testServerGUID();
testFill();
@@ -280,5 +300,6 @@ MAIN(testutil)
testAccount();
testTestEq();
testStrDiff();
testOnce();
return testDone();
}