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
+28 -1
View File
@@ -273,6 +273,32 @@ struct Tester {
testOk1(!done.wait(2.1));
}
void asyncCancel()
{
testShow()<<__func__;
struct info_t {
client::Result actual;
epicsEvent done;
};
auto info(std::make_shared<info_t>());
serv.start();
// not storing Operation -> immediate cancel()
cli.info("mailbox")
.syncCancel(false)
.result([info](client::Result&& result) {
info->actual = std::move(result);
info->done.signal();
})
.exec();
cli.hurryUp();
testOk1(!info->done.wait(2.1));
}
void orphan()
{
testShow()<<__func__;
@@ -395,7 +421,7 @@ void testError(bool phase)
MAIN(testget)
{
testPlan(51);
testPlan(52);
testSetup();
logger_config_env();
Tester().testConnector();
@@ -404,6 +430,7 @@ MAIN(testget)
Tester().lazy();
Tester().timeout();
Tester().cancel();
Tester().asyncCancel();
Tester().orphan();
Tester().manualExec();
testError(false);