post() with const ref.

Added "safety" of passing move-able reference
is an illusion since no use_count()==1 test
is done.  Instead extra (shallow) copies
were made for each subscriber.

Instead.  Pass const reference, redefine
MonitorControlOp::post() to transfer ownership,
and make only a single copy in SharedPV::post().
This commit is contained in:
Michael Davidsaver
2020-07-26 20:46:12 -07:00
parent 7debb1fae3
commit 24f3478c98
8 changed files with 29 additions and 21 deletions
+5 -5
View File
@@ -68,7 +68,7 @@ struct BasicTest {
{
auto update(initial.cloneEmpty());
update["value"] = v;
mbox.post(std::move(update));
mbox.post(update);
}
static
@@ -183,7 +183,7 @@ struct TestLifeCycle : public BasicTest
auto update(initial.cloneEmpty());
update["value"] = 39;
mbox2.post(std::move(update));
mbox2.post(update);
if(auto val = pop(sub2, evt2)) {
testEq(val["value"].as<int32_t>(), 39);
@@ -224,9 +224,9 @@ struct TestReconn : public BasicTest
testFalse(sub->pop())<<"No events after Disconnect";
mbox.post(std::move(initial
.cloneEmpty()
.update("value", 15)));
mbox.post(initial
.cloneEmpty()
.update("value", 15));
errlogFlush();
testDiag("Starting server");