diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2021-03-21 21:08:16 +0100 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-04-05 07:15:18 -0400 |
commit | d2680c18d36148cd87582ec4adc6f38b27e249db (patch) | |
tree | 84a90a9684ed36ebd5ee6ff6e86b31623ea71b4a /gnuradio-runtime/lib/basic_block.cc | |
parent | 9ff812715657f964e7a7a7256c4600353d43b741 (diff) |
runtime: don't do two lookups to verify existence and get msg handler
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
Diffstat (limited to 'gnuradio-runtime/lib/basic_block.cc')
-rw-r--r-- | gnuradio-runtime/lib/basic_block.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gnuradio-runtime/lib/basic_block.cc b/gnuradio-runtime/lib/basic_block.cc index 6061026a56..52a1a5e16b 100644 --- a/gnuradio-runtime/lib/basic_block.cc +++ b/gnuradio-runtime/lib/basic_block.cc @@ -173,15 +173,15 @@ void basic_block::_post(pmt::pmt_t which_port, pmt::pmt_t msg) void basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg) { gr::thread::scoped_lock guard(mutex); - - if (msg_queue.find(which_port) == msg_queue.end()) { + const auto& queue = msg_queue.find(which_port); + if (queue == msg_queue.end()) { GR_LOG_ERROR(d_logger, std::string("attempted insertion on invalid queue ") + pmt::symbol_to_string(which_port)); throw std::runtime_error("attempted to insert_tail on invalid queue!"); } - msg_queue[which_port].push_back(msg); + queue->second.push_back(msg); // wake up thread if BLKD_IN or BLKD_OUT global_block_registry.notify_blk(d_symbol_name); |