client: add *Builder::syncCancel(bool)

Option for asynchronous cancel (eg. implicitly through ~Operation).
This commit is contained in:
Michael Davidsaver
2020-12-30 10:43:15 -08:00
parent c4d2cd4a10
commit 708fbc8062
9 changed files with 143 additions and 43 deletions
+32 -1
View File
@@ -95,6 +95,35 @@ struct BasicTest {
cli = client::Context();
op.reset();
}
void cancel()
{
testShow()<<__func__;
epicsEvent done;
cli.monitor("nonexistent")
.onInit([&done](const Value&) {
done.signal();
})
.exec();
testOk1(!done.wait(1.1));
}
void asyncCancel()
{
testShow()<<__func__;
auto done(std::make_shared<epicsEvent>());
cli.monitor("nonexistent")
.syncCancel(false)
.onInit([done](const Value&) {
done->signal();
})
.exec();
testOk1(!done->wait(1.1));
}
};
struct TestLifeCycle : public BasicTest
@@ -261,10 +290,12 @@ struct TestReconn : public BasicTest
MAIN(testmon)
{
testPlan(22);
testPlan(24);
testSetup();
logger_config_env();
BasicTest().orphan();
BasicTest().cancel();
BasicTest().asyncCancel();
TestLifeCycle().testBasic(true);
TestLifeCycle().testBasic(false);
TestLifeCycle().testSecond();