【发布时间】:2017-02-03 11:42:29
【问题描述】:
我每天都在学习更多关于 dds 的知识,所以我的问题听起来很奇怪。我希望这是有道理的。
我正在编写的某些 dds 包装器的要求之一是,如果它无法写入,它会在一段时间后超时。 我的问题:我该怎么做?
在Prism Tech's website's tutorial 上,有关于如何使用WaitSet 来阻止读取操作的说明,但是写入呢?
这是一些包含问题的代码:
dds::domain::DomainParticipant dp(0);
dds::topic::Topic<MyType> topic(dp, "MyTopic");
dds::pub::Publisher pub(dp);
dds::pub::DataWriter<MyType> dw(pub, topic);
MyType t;
dw.write(t); //how can I make this block for 5 seconds (tops), and then throw an error on failure?
我注意到 API DataWriter::wait_for_acknowledgements(int timeout) 中存在一个函数,但这似乎绑定到 DataWriter 对象,而不是特定的编写调用。我可以将它与上面的调用绑定吗?
【问题讨论】:
标签: c++ synchronous data-distribution-service opensplice