summaryrefslogtreecommitdiff
path: root/gr-zeromq/lib/sub_msg_source_impl.cc
diff options
context:
space:
mode:
authorMarcus Müller <mueller@kit.edu>2018-02-20 11:33:33 +0100
committerMarcus Müller <marcus@hostalia.de>2018-02-23 19:06:50 +0100
commit28401b7a01d9e6f25c6057f7b9dc07c8e568ff60 (patch)
tree0b38941011f873953c15987688460ef1e8e98c49 /gr-zeromq/lib/sub_msg_source_impl.cc
parent97f0d1cecf4a8cb82e8e16e4dfcac0589c5b56c7 (diff)
zeromq: remove unnecessary call to pmt::intern at runtime
typical usage: message_port_pub(pmt::mp("out_port"), …) which is bad, as it implies hashing of a string, allocation of memory, deallocation, finding the hashed string in the table of interned strings and returning a unique pointer (which for reasons of PMT awesomeness isn't even unique) to the interned port name. Replacing all these port name ad hoc ::mp() calls by reusing one, private, port name member.
Diffstat (limited to 'gr-zeromq/lib/sub_msg_source_impl.cc')
-rw-r--r--gr-zeromq/lib/sub_msg_source_impl.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gr-zeromq/lib/sub_msg_source_impl.cc b/gr-zeromq/lib/sub_msg_source_impl.cc
index 4a44442e62..8ed2420293 100644
--- a/gr-zeromq/lib/sub_msg_source_impl.cc
+++ b/gr-zeromq/lib/sub_msg_source_impl.cc
@@ -44,7 +44,8 @@ namespace gr {
: gr::block("sub_msg_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
- d_timeout(timeout)
+ d_timeout(timeout),
+ d_port(pmt::mp("out"))
{
int major, minor, patch;
zmq::version(&major, &minor, &patch);
@@ -59,7 +60,7 @@ namespace gr {
d_socket->setsockopt(ZMQ_SUBSCRIBE, "", 0);
d_socket->connect (address);
- message_port_register_out(pmt::mp("out"));
+ message_port_register_out(d_port);
}
sub_msg_source_impl::~sub_msg_source_impl()
@@ -101,7 +102,7 @@ namespace gr {
std::stringbuf sb(buf);
pmt::pmt_t m = pmt::deserialize(sb);
- message_port_pub(pmt::mp("out"), m);
+ message_port_pub(d_port, m);
} else {
boost::this_thread::sleep(boost::posix_time::microseconds(100));
}