summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_accepter.cc44
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_accepter.h40
-rw-r--r--gruel/src/include/gruel/msg_accepter_msgq.h3
6 files changed, 91 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index 14ab464ad..b0e804277 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -44,6 +44,7 @@ libruntime_la_SOURCES = \
gr_io_signature.cc \
gr_local_sighandler.cc \
gr_message.cc \
+ gr_msg_accepter.cc \
gr_msg_handler.cc \
gr_msg_queue.cc \
gr_pagesize.cc \
@@ -96,6 +97,7 @@ grinclude_HEADERS = \
gr_io_signature.h \
gr_local_sighandler.h \
gr_message.h \
+ gr_msg_accepter.h \
gr_msg_handler.h \
gr_msg_queue.h \
gr_pagesize.h \
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
index 71ccc0245..8efa8267a 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
@@ -41,7 +41,7 @@ gr_basic_block_ncurrently_allocated()
gr_basic_block::gr_basic_block(const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature)
- : gruel::msg_accepter_msgq(gruel::make_msg_queue(0)),
+ : gr_msg_accepter(gruel::make_msg_queue(0)), // Non-blocking insert
d_name(name),
d_input_signature(input_signature),
d_output_signature(output_signature),
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
index 27ec0fd89..5d5b8cbc7 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -26,7 +26,7 @@
#include <gr_runtime_types.h>
#include <gr_sptr_magic.h>
#include <boost/enable_shared_from_this.hpp>
-#include <gruel/msg_accepter_msgq.h>
+#include <gr_msg_accepter.h>
#include <string>
/*!
@@ -40,7 +40,7 @@
* signal processing functions.
*/
-class gr_basic_block : gruel::msg_accepter_msgq, public boost::enable_shared_from_this<gr_basic_block>
+class gr_basic_block : gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block>
{
protected:
friend class gr_flowgraph;
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc b/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc
new file mode 100644
index 000000000..b07f447c9
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_msg_accepter.h>
+
+using namespace pmt;
+
+gr_msg_accepter::gr_msg_accepter(gruel::msg_queue_sptr msgq)
+ : gruel::msg_accepter_msgq(msgq)
+{
+}
+
+gr_msg_accepter::~gr_msg_accepter()
+{
+ // NOP, required as virtual destructor
+}
+
+void
+gr_msg_accepter::post(pmt_t msg)
+{
+ d_msg_queue->insert_tail(msg);
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h
new file mode 100644
index 000000000..8ce8d1d9e
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GR_MSG_ACCEPTER_H
+#define INCLUDED_GR_MSG_ACCEPTER_H
+
+#include <gruel/msg_accepter_msgq.h>
+
+/*!
+ * \brief Accepts messages and inserts them into a message queue, then notifies
+ * subclass gr_basic_block there is a message pending.
+ */
+class gr_msg_accepter : gruel::msg_accepter_msgq
+{
+public:
+ gr_msg_accepter(gruel::msg_queue_sptr msgq);
+ ~gr_msg_accepter();
+
+ void post(pmt::pmt_t msg);
+};
+
+#endif /* INCLUDED_GR_MSG_ACCEPTER_H */
diff --git a/gruel/src/include/gruel/msg_accepter_msgq.h b/gruel/src/include/gruel/msg_accepter_msgq.h
index b14049d54..bf1762e92 100644
--- a/gruel/src/include/gruel/msg_accepter_msgq.h
+++ b/gruel/src/include/gruel/msg_accepter_msgq.h
@@ -32,13 +32,14 @@ namespace gruel {
*/
class msg_accepter_msgq : public msg_accepter
{
+ protected:
msg_queue_sptr d_msg_queue;
public:
msg_accepter_msgq(msg_queue_sptr msgq);
~msg_accepter_msgq();
- void post(pmt::pmt_t msg);
+ virtual void post(pmt::pmt_t msg);
msg_queue_sptr msg_queue() const { return d_msg_queue; }
};