[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4809 - in gnuradio/trunk: . mblock/src/lib
From: |
eb |
Subject: |
[Commit-gnuradio] r4809 - in gnuradio/trunk: . mblock/src/lib |
Date: |
Wed, 28 Mar 2007 12:58:21 -0600 (MDT) |
Author: eb
Date: 2007-03-28 12:58:21 -0600 (Wed, 28 Mar 2007)
New Revision: 4809
Added:
gnuradio/trunk/mblock/src/lib/README.locking
gnuradio/trunk/mblock/src/lib/mb_runtime_nop.cc
gnuradio/trunk/mblock/src/lib/mb_runtime_nop.h
gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.cc
gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.h
gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.cc
gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.h
gnuradio/trunk/mblock/src/lib/mbi_runtime_lock.h
Removed:
gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.cc
gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.h
Modified:
gnuradio/trunk/configure.ac
gnuradio/trunk/mblock/src/lib/Makefile.am
gnuradio/trunk/mblock/src/lib/mb_common.h
gnuradio/trunk/mblock/src/lib/mb_mblock.cc
gnuradio/trunk/mblock/src/lib/mb_mblock.h
gnuradio/trunk/mblock/src/lib/mb_mblock_impl.cc
gnuradio/trunk/mblock/src/lib/mb_mblock_impl.h
gnuradio/trunk/mblock/src/lib/mb_msg_accepter_smp.cc
gnuradio/trunk/mblock/src/lib/mb_msg_queue.cc
gnuradio/trunk/mblock/src/lib/mb_msg_queue.h
gnuradio/trunk/mblock/src/lib/mb_port_simple.cc
gnuradio/trunk/mblock/src/lib/mb_runtime.cc
gnuradio/trunk/mblock/src/lib/mb_runtime.h
gnuradio/trunk/mblock/src/lib/qa_mblock_prims.cc
gnuradio/trunk/mblock/src/lib/qa_mblock_send.cc
Log:
Merged mblock work-in-progress eb/mb -r4798:4808 into trunk.
Modified: gnuradio/trunk/configure.ac
===================================================================
--- gnuradio/trunk/configure.ac 2007-03-28 17:15:26 UTC (rev 4808)
+++ gnuradio/trunk/configure.ac 2007-03-28 18:58:21 UTC (rev 4809)
@@ -213,7 +213,7 @@
GRC_GR_RADIO_ASTRONOMY
GRC_GR_TRELLIS
GRC_GR_VIDEO_SDL
-#GRC_GR_QTGUI dnl disabled until grc_gr_qtgui.m4 is final
+GRC_GR_QTGUI dnl disabled until grc_gr_qtgui.m4 is final
GRC_GR_WXGUI
GRC_PMT
GRC_MBLOCK dnl this must come after GRC_PMT
Modified: gnuradio/trunk/mblock/src/lib/Makefile.am
===================================================================
--- gnuradio/trunk/mblock/src/lib/Makefile.am 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/Makefile.am 2007-03-28 18:58:21 UTC (rev
4809)
@@ -27,7 +27,8 @@
lib_LTLIBRARIES = libmblock.la libmblock-qa.la
-EXTRA_DIST =
+EXTRA_DIST = \
+ README.locking
# These are the source files that go into the mblock shared library
@@ -45,7 +46,9 @@
mb_port_simple.cc \
mb_protocol_class.cc \
mb_runtime.cc \
- mb_runtime_single_threaded.cc \
+ mb_runtime_nop.cc \
+ mb_runtime_placeholder.cc \
+ mb_runtime_thread_per_mblock.cc \
mb_util.cc
@@ -69,7 +72,9 @@
mb_port_simple.h \
mb_protocol_class.h \
mb_runtime.h \
- mb_runtime_single_threaded.h \
+ mb_runtime_nop.h \
+ mb_runtime_placeholder.h \
+ mb_runtime_thread_per_mblock.h \
mb_util.h
@@ -78,6 +83,7 @@
mb_endpoint.h \
mb_mblock_impl.h \
mb_msg_accepter_smp.h \
+ mbi_runtime_lock.h \
qa_mblock.h \
qa_mblock_prims.h \
qa_mblock_send.h
Copied: gnuradio/trunk/mblock/src/lib/README.locking (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/README.locking)
===================================================================
--- gnuradio/trunk/mblock/src/lib/README.locking
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/README.locking 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -0,0 +1,4 @@
+The Big Runtime Lock must be held when:
+
+Manipulating or traversing any mblock's d_port_map, d_comp_map or d_conn_table.
+
Modified: gnuradio/trunk/mblock/src/lib/mb_common.h
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_common.h 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/mb_common.h 2007-03-28 18:58:21 UTC (rev
4809)
@@ -26,8 +26,8 @@
#include <stdexcept>
#include <boost/utility.hpp>
#include <boost/enable_shared_from_this.hpp>
+#include <boost/weak_ptr.hpp>
-
/*
* The priority type and valid range
*/
Modified: gnuradio/trunk/mblock/src/lib/mb_mblock.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_mblock.cc 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/mb_mblock.cc 2007-03-28 18:58:21 UTC (rev
4809)
@@ -121,17 +121,29 @@
}
std::string
-mb_mblock::fullname() const
+mb_mblock::instance_name() const
{
- return d_impl->fullname();
+ return d_impl->instance_name();
}
void
-mb_mblock::set_fullname(const std::string name)
+mb_mblock::set_instance_name(const std::string name)
{
- d_impl->set_fullname(name);
+ d_impl->set_instance_name(name);
}
+std::string
+mb_mblock::class_name() const
+{
+ return d_impl->class_name();
+}
+
+void
+mb_mblock::set_class_name(const std::string name)
+{
+ d_impl->set_class_name(name);
+}
+
mb_mblock *
mb_mblock::parent() const
{
Modified: gnuradio/trunk/mblock/src/lib/mb_mblock.h
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_mblock.h 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/mb_mblock.h 2007-03-28 18:58:21 UTC (rev
4809)
@@ -24,7 +24,6 @@
#include <mb_common.h>
#include <mb_message.h>
#include <mb_port.h>
-#include <boost/enable_shared_from_this.hpp>
/*!
@@ -175,15 +174,21 @@
int
nconnections() const;
+ //! Set the class name
+ void set_class_name(const std::string name);
public:
virtual ~mb_mblock();
- void set_fullname(const std::string name);
+ //! Return instance name of this block
+ std::string instance_name() const;
+
+ //! Return the class name of this block
+ std::string class_name() const;
+
+ //! Set the instance name of this block.
+ void set_instance_name(const std::string name);
- //! Return full name of this block
- std::string fullname() const;
-
//! Return the parent of this mblock, or 0 if we're the top-level block.
mb_mblock *parent() const;
Modified: gnuradio/trunk/mblock/src/lib/mb_mblock_impl.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_mblock_impl.cc 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_mblock_impl.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -30,6 +30,8 @@
#include <mb_exception.h>
#include <mb_util.h>
#include <mb_msg_accepter_smp.h>
+#include <mb_runtime_placeholder.h>
+#include <mbi_runtime_lock.h>
static pmt_t s_self = pmt_intern("self");
@@ -51,7 +53,8 @@
////////////////////////////////////////////////////////////////////////
mb_mblock_impl::mb_mblock_impl(mb_mblock *mb)
- : d_mb(mb), d_mb_parent(0), d_fullname("<unknown>")
+ : d_mb(mb), d_mb_parent(0), d_runtime(mb_runtime_placeholder::singleton()),
+ d_instance_name("<unknown>"), d_class_name("mblock")
{
}
@@ -67,6 +70,8 @@
bool conjugated,
mb_port::port_type_t port_type)
{
+ mbi_runtime_lock l(this);
+
if (port_is_defined(port_name))
throw mbe_duplicate_port(d_mb, port_name);
@@ -82,6 +87,8 @@
mb_mblock_impl::define_component(const std::string &name,
mb_mblock_sptr component)
{
+ mbi_runtime_lock l(this);
+
if (comp_is_defined(name)) // check for duplicate name
throw mbe_duplicate_component(d_mb, name);
@@ -95,6 +102,8 @@
const std::string &comp_name2,
const std::string &port_name2)
{
+ mbi_runtime_lock l(this);
+
mb_endpoint ep0 = check_and_resolve_endpoint(comp_name1, port_name1);
mb_endpoint ep1 = check_and_resolve_endpoint(comp_name2, port_name2);
@@ -113,24 +122,32 @@
const std::string &comp_name2,
const std::string &port_name2)
{
+ mbi_runtime_lock l(this);
+
d_conn_table.disconnect(comp_name1, port_name1, comp_name2, port_name2);
}
void
mb_mblock_impl::disconnect_component(const std::string component_name)
{
+ mbi_runtime_lock l(this);
+
d_conn_table.disconnect_component(component_name);
}
void
mb_mblock_impl::disconnect_all()
{
+ mbi_runtime_lock l(this);
+
d_conn_table.disconnect_all();
}
int
-mb_mblock_impl::nconnections() const
+mb_mblock_impl::nconnections()
{
+ mbi_runtime_lock l(this);
+
return d_conn_table.nconnections();
}
@@ -219,6 +236,7 @@
mb_msg_accepter_sptr
mb_mblock_impl::make_accepter(const std::string port_name)
{
+ // FIXME this should probably use some kind of configurable factory
mb_msg_accepter *ma =
new mb_msg_accepter_smp(d_mb->shared_from_this(),
pmt_intern(port_name));
@@ -252,8 +270,14 @@
}
void
-mb_mblock_impl::set_fullname(const std::string &name)
+mb_mblock_impl::set_instance_name(const std::string &name)
{
- d_fullname = name;
+ d_instance_name = name;
}
+void
+mb_mblock_impl::set_class_name(const std::string &name)
+{
+ d_class_name = name;
+}
+
Modified: gnuradio/trunk/mblock/src/lib/mb_mblock_impl.h
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_mblock_impl.h 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_mblock_impl.h 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -39,8 +39,10 @@
{
mb_mblock *d_mb; // pointer to our associated
mblock
mb_mblock *d_mb_parent; // pointer to our parent
+ mb_runtime *d_runtime; // pointer to runtime
- std::string d_fullname; // hierarchical name
+ std::string d_instance_name; // hierarchical name
+ std::string d_class_name; // name of this (derived)
class
mb_port_map_t d_port_map; // our ports
mb_comp_map_t d_comp_map; // our components
@@ -136,7 +138,7 @@
* \brief Return number of connections (QA mostly)
*/
int
- nconnections() const;
+ nconnections();
bool
walk_tree(mb_visitor *visitor, const std::string &path="");
@@ -147,12 +149,18 @@
mb_msg_queue &
msgq() { return d_msgq; }
- //! Return full name of this block
- std::string fullname() const { return d_fullname; }
+ //! Return instance name of this block
+ std::string instance_name() const { return d_instance_name; }
- //! Set the name of this block
- void set_fullname(const std::string &name);
+ //! Set the instance name of this block
+ void set_instance_name(const std::string &name);
+ //! Return the class name of this block
+ std::string class_name() const { return d_class_name; }
+
+ //! Set the class name
+ void set_class_name(const std::string &name);
+
/*!
* \brief If bound, store endpoint from the other end of the connection.
*
@@ -165,16 +173,21 @@
lookup_other_endpoint(const mb_port *port, mb_endpoint *ep);
- mb_mblock *
- mblock() const { return d_mb; }
+ //! Return point to associated mblock
+ mb_mblock *mblock() const { return d_mb; }
- mb_mblock *
- mblock_parent() const { return d_mb_parent; }
+ //! Return pointer to the parent of our mblock
+ mb_mblock *mblock_parent() const { return d_mb_parent; }
- mb_mblock_sptr
- component(const std::string &comp_name);
+ //! Lookup a component by name
+ mb_mblock_sptr component(const std::string &comp_name);
+ //! Return the runtime instance
+ mb_runtime *runtime() { return d_runtime; }
+ //! Set the runtime instance
+ void set_runtime(mb_runtime *runtime) { d_runtime = runtime; }
+
/*
* Our implementation methods
*/
Modified: gnuradio/trunk/mblock/src/lib/mb_msg_accepter_smp.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_msg_accepter_smp.cc 2007-03-28
17:15:26 UTC (rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_msg_accepter_smp.cc 2007-03-28
18:58:21 UTC (rev 4809)
@@ -45,6 +45,4 @@
mb_message_sptr msg = mb_make_message(signal, data, metadata, priority);
msg->set_port_id(d_port_name);
d_mb->impl()->msgq().insert(msg);
-
- // FIXME tell runtime that we're ready to run
}
Modified: gnuradio/trunk/mblock/src/lib/mb_msg_queue.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_msg_queue.cc 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_msg_queue.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -25,9 +25,9 @@
#include <mb_msg_queue.h>
#include <mb_message.h>
-// FIXME turn this into a template so we can use it for the runq of mblocks too
mb_msg_queue::mb_msg_queue()
+ : d_not_empty(&d_mutex)
{
}
@@ -51,14 +51,21 @@
d_queue[q].tail = msg;
msg->d_next.reset(); // msg->d_next = 0;
}
+
// FIXME set bit in bitmap
+
+ d_not_empty.signal();
}
+/*
+ * Delete highest pri message from the queue and return it.
+ * Returns equivalent of zero pointer if queue is empty.
+ *
+ * Caller must be holding d_mutex
+ */
mb_message_sptr
-mb_msg_queue::get_highest_pri_msg()
+mb_msg_queue::get_highest_pri_msg_helper()
{
- omni_mutex_lock l(d_mutex);
-
// FIXME use bitmap and ffz to find best queue in O(1)
for (mb_pri_t q = 0; q <= MB_PRI_WORST; q++){
@@ -78,3 +85,27 @@
return mb_message_sptr(); // equivalent of a zero pointer
}
+
+
+mb_message_sptr
+mb_msg_queue::get_highest_pri_msg_nowait()
+{
+ omni_mutex_lock l(d_mutex);
+
+ return get_highest_pri_msg_helper();
+}
+
+mb_message_sptr
+mb_msg_queue::get_highest_pri_msg()
+{
+ omni_mutex_lock l(d_mutex);
+
+ while (1){
+ mb_message_sptr msg = get_highest_pri_msg_helper();
+ if (msg) // Got one; return it
+ return msg;
+
+ d_not_empty.wait(); // Wait for something
+ }
+}
+
Modified: gnuradio/trunk/mblock/src/lib/mb_msg_queue.h
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_msg_queue.h 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_msg_queue.h 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -37,11 +37,14 @@
bool empty_p() const { return head == 0; }
};
- omni_mutex d_mutex;
+ omni_mutex d_mutex;
+ omni_condition d_not_empty; // reader waits on this
// FIXME add bitmap to indicate which queues are non-empty.
- subq d_queue[MB_NPRI];
+ subq d_queue[MB_NPRI];
+ mb_message_sptr get_highest_pri_msg_helper();
+
public:
mb_msg_queue();
~mb_msg_queue();
@@ -53,6 +56,12 @@
* \brief Delete highest pri message from the queue and return it.
* Returns equivalent of zero pointer if queue is empty.
*/
+ mb_message_sptr get_highest_pri_msg_nowait();
+
+ /*
+ * \brief Delete highest pri message from the queue and return it.
+ * If the queue is empty, this call blocks until it can return a message.
+ */
mb_message_sptr get_highest_pri_msg();
};
Modified: gnuradio/trunk/mblock/src/lib/mb_port_simple.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_port_simple.cc 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/mb_port_simple.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -29,6 +29,7 @@
#include <mb_mblock.h>
#include <mb_mblock_impl.h>
#include <assert.h>
+#include <mbi_runtime_lock.h>
mb_port_simple::mb_port_simple(mb_mblock *mblock,
@@ -49,7 +50,7 @@
mb_port_simple::send(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t
priority)
{
if (port_type() == mb_port::RELAY) // Can't send directly to a RELAY port
- throw mbe_invalid_port_type(mblock(), mblock()->fullname(), port_name());
+ throw mbe_invalid_port_type(mblock(), mblock()->instance_name(),
port_name());
mb_msg_accepter_sptr accepter = find_accepter(this);
if (accepter)
@@ -66,6 +67,8 @@
mb_endpoint peer_ep;
mb_msg_accepter_sptr r;
+ mbi_runtime_lock l(p->mblock());
+
// Set up initial context.
switch(p->port_type()){
Modified: gnuradio/trunk/mblock/src/lib/mb_runtime.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime.cc 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime.cc 2007-03-28 18:58:21 UTC (rev
4809)
@@ -24,12 +24,12 @@
#endif
#include <mb_runtime.h>
-#include <mb_runtime_single_threaded.h>
+#include <mb_runtime_thread_per_mblock.h>
mb_runtime_sptr
mb_make_runtime()
{
- return mb_runtime_sptr(new mb_runtime_single_threaded());
+ return mb_runtime_sptr(new mb_runtime_thread_per_mblock());
}
mb_runtime::~mb_runtime()
Modified: gnuradio/trunk/mblock/src/lib/mb_runtime.h
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime.h 2007-03-28 17:15:26 UTC (rev
4808)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime.h 2007-03-28 18:58:21 UTC (rev
4809)
@@ -22,6 +22,7 @@
#define INCLUDED_MB_RUNTIME_H
#include <mb_common.h>
+#include <omnithread.h>
/*!
* \brief Public constructor (factory) for mb_runtime objects.
@@ -33,8 +34,11 @@
*
* There should generally be only a single instance of this class.
*/
-class mb_runtime : boost::noncopyable
+class mb_runtime : boost::noncopyable,
+ public boost::enable_shared_from_this<mb_runtime>
{
+ omni_mutex d_brl; // big runtime lock (avoid using this if
possible...)
+
public:
mb_runtime(){}
virtual ~mb_runtime();
@@ -49,6 +53,24 @@
* \returns true if the system ran successfully.
*/
virtual bool run(mb_mblock_sptr top) = 0;
+
+
+ // ----------------------------------------------------------------
+ // Stuff from here down is really private to the implementation...
+ // ----------------------------------------------------------------
+
+ /*!
+ * \brief lock the big runtime lock
+ * \implementation
+ */
+ inline void lock() { d_brl.lock(); }
+
+ /*!
+ * \brief unlock the big runtime lock
+ * \implementation
+ */
+ inline void unlock() { d_brl.unlock(); }
+
};
#endif /* INCLUDED_MB_RUNTIME_H */
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_nop.cc (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_nop.cc)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_nop.cc
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_nop.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <mb_runtime_nop.h>
+#include <mb_mblock.h>
+
+mb_runtime_sptr
+mb_make_runtime_nop()
+{
+ return mb_runtime_sptr(new mb_runtime_nop());
+}
+
+
+mb_runtime_nop::mb_runtime_nop()
+{
+ // nop for now
+}
+
+mb_runtime_nop::~mb_runtime_nop()
+{
+ // nop for now
+}
+
+bool
+mb_runtime_nop::run(mb_mblock_sptr top)
+{
+ class initial_visitor : public mb_visitor
+ {
+ public:
+ bool operator()(mb_mblock *mblock, const std::string &path)
+ {
+ mblock->set_instance_name(path);
+ mblock->init_fsm();
+ return true;
+ }
+ };
+
+ initial_visitor visitor;
+
+ top->walk_tree(&visitor);
+
+ return true;
+}
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_nop.h (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_nop.h)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_nop.h
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_nop.h 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MB_RUNTIME_NOP_H
+#define INCLUDED_MB_RUNTIME_NOP_H
+
+#include <mb_runtime.h>
+
+/*!
+ * \brief Public constructor (factory) for mb_runtime_nop objects.
+ */
+mb_runtime_sptr mb_make_runtime_nop();
+
+/*!
+ * \brief Concrete runtime that does nothing. Used only during early QA tests.
+ */
+class mb_runtime_nop : public mb_runtime
+{
+
+public:
+ mb_runtime_nop();
+ ~mb_runtime_nop();
+
+ bool run(mb_mblock_sptr top);
+};
+
+#endif /* INCLUDED_MB_RUNTIME_NOP_H */
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.cc (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_placeholder.cc)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.cc
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.cc 2007-03-28
18:58:21 UTC (rev 4809)
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <mb_runtime_placeholder.h>
+#include <mb_mblock.h>
+#include <mb_exception.h>
+
+
+static mb_runtime *s_singleton = 0;
+
+
+mb_runtime_placeholder::mb_runtime_placeholder()
+{
+ // nop
+}
+
+mb_runtime_placeholder::~mb_runtime_placeholder()
+{
+ // nop
+}
+
+bool
+mb_runtime_placeholder::run(mb_mblock_sptr top)
+{
+ throw mbe_not_implemented(top.get(), "mb_runtime_placeholder::run");
+}
+
+mb_runtime *
+mb_runtime_placeholder::singleton()
+{
+ if (s_singleton)
+ return s_singleton;
+
+ s_singleton = new mb_runtime_placeholder();
+ return s_singleton;
+}
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.h (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_placeholder.h)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.h
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_placeholder.h 2007-03-28
18:58:21 UTC (rev 4809)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MB_RUNTIME_PLACEHOLDER_H
+#define INCLUDED_MB_RUNTIME_PLACEHOLDER_H
+
+#include <mb_runtime.h>
+
+/*!
+ * \brief Concrete runtime that serves as a placeholder until the real
+ * runtime is known.
+ *
+ * The singleton instance of this class is installed in the d_runtime
+ * instance variable of each mb_mblock_impl at construction time.
+ * Having a valid instance of runtime removes the "pre runtime::run"
+ * corner case, and allows us to lock and unlock the big runtime lock
+ * even though there's no "real runtime" yet.
+ */
+class mb_runtime_placeholder : public mb_runtime
+{
+
+public:
+ mb_runtime_placeholder();
+ ~mb_runtime_placeholder();
+
+ //! throws mbe_not_implemented
+ bool run(mb_mblock_sptr top);
+
+ //! Return the placeholder singleton
+ static mb_runtime *singleton();
+};
+
+#endif /* INCLUDED_MB_RUNTIME_PLACEHOLDER_H */
Deleted: gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.cc
Deleted: gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.h
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.cc (from rev
4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_thread_per_mblock.cc)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.cc
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.cc
2007-03-28 18:58:21 UTC (rev 4809)
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <mb_runtime_thread_per_mblock.h>
+#include <mb_mblock.h>
+#include <mb_mblock_impl.h>
+
+
+mb_runtime_thread_per_mblock::mb_runtime_thread_per_mblock()
+{
+ // nop for now
+}
+
+mb_runtime_thread_per_mblock::~mb_runtime_thread_per_mblock()
+{
+ // nop for now
+}
+
+bool
+mb_runtime_thread_per_mblock::run(mb_mblock_sptr top)
+{
+ class initial_visitor : public mb_visitor
+ {
+ mb_runtime *d_rt;
+
+ public:
+ initial_visitor(mb_runtime *rt) : d_rt(rt) {}
+ bool operator()(mb_mblock *mblock, const std::string &path)
+ {
+ mblock->impl()->set_runtime(d_rt);
+ mblock->set_instance_name(path);
+ mblock->init_fsm();
+ return true;
+ }
+ };
+
+ initial_visitor visitor(this);
+
+ d_top = top; // remember top of tree
+
+ d_top->walk_tree(&visitor);
+
+ return true;
+}
Copied: gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.h (from rev
4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_runtime_thread_per_mblock.h)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.h
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mb_runtime_thread_per_mblock.h
2007-03-28 18:58:21 UTC (rev 4809)
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MB_RUNTIME_THREAD_PER_MBLOCK_H
+#define INCLUDED_MB_RUNTIME_THREAD_PER_MBLOCK_H
+
+#include <mb_runtime.h>
+
+/*!
+ * \brief Concrete runtime that uses a single thread for all work.
+ */
+class mb_runtime_thread_per_mblock : public mb_runtime
+{
+ mb_mblock_sptr d_top; // top mblock
+
+public:
+ mb_runtime_thread_per_mblock();
+ ~mb_runtime_thread_per_mblock();
+
+ bool run(mb_mblock_sptr top);
+};
+
+#endif /* INCLUDED_MB_RUNTIME_THREAD_PER_MBLOCK_H */
Copied: gnuradio/trunk/mblock/src/lib/mbi_runtime_lock.h (from rev 4808,
gnuradio/branches/developers/eb/mb/mblock/src/lib/mbi_runtime_lock.h)
===================================================================
--- gnuradio/trunk/mblock/src/lib/mbi_runtime_lock.h
(rev 0)
+++ gnuradio/trunk/mblock/src/lib/mbi_runtime_lock.h 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MBI_RUNTIME_LOCK_H
+#define INCLUDED_MBI_RUNTIME_LOCK_H
+
+#include <mb_runtime.h>
+#include <mb_mblock_impl.h>
+#include <boost/utility.hpp>
+
+/*!
+ * \brief acquire and release big runtime lock
+ *
+ * As an alternative to:
+ * {
+ * rt->lock();
+ * .....
+ * rt->unlock();
+ * }
+ *
+ * you can use a single instance of the mbi_runtime_lock class:
+ *
+ * {
+ * mbi_runtime_lock l(rt);
+ * ....
+ * }
+ *
+ * This has the advantage that rt->unlock() will be called automatically
+ * when an exception is thrown.
+ */
+
+class mbi_runtime_lock : boost::noncopyable {
+ mb_runtime *d_rt;
+public:
+ mbi_runtime_lock(mb_runtime *rt) : d_rt(rt) { d_rt->lock(); }
+ mbi_runtime_lock(mb_mblock_impl *mi) : d_rt(mi->runtime()) { d_rt->lock(); }
+ mbi_runtime_lock(mb_mblock *mb) : d_rt(mb->impl()->runtime()) {
d_rt->lock(); }
+ ~mbi_runtime_lock(void) { d_rt->unlock(); }
+
+};
+
+#endif /* INCLUDED_MBI_RUNTIME_LOCK_H */
+
Modified: gnuradio/trunk/mblock/src/lib/qa_mblock_prims.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/qa_mblock_prims.cc 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/qa_mblock_prims.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -95,7 +95,6 @@
void
qa_mblock_prims::test_define_ports()
{
- mb_runtime_sptr rt = mb_make_runtime();
// std::vector<mb_port_sptr> intf;
mb_mblock_sptr mb1 = mb_mblock_sptr(new dp_1());
@@ -175,7 +174,6 @@
void
qa_mblock_prims::test_define_components()
{
- mb_runtime_sptr rt = mb_make_runtime();
mb_mblock_sptr mb1 = mb_mblock_sptr(new dc_ok()); // OK
// raises pmt_exception because of duplicate component definition of "c0"
@@ -317,8 +315,6 @@
pmt_list1(pmt_intern("in")), // in
pmt_list1(pmt_intern("out"))); // out
-
- mb_runtime_sptr rt = mb_make_runtime();
mb_mblock_sptr mb0 = mb_mblock_sptr(new tc_0());
}
@@ -330,7 +326,7 @@
mb_msg_queue q;
// check initial state
- CPPUNIT_ASSERT(q.get_highest_pri_msg() == 0);
+ CPPUNIT_ASSERT(q.get_highest_pri_msg_nowait() == 0);
CPPUNIT_ASSERT(MB_NPRI >= 5); // sanity check for this test
@@ -340,11 +336,11 @@
q.insert(mb_make_message(PMT_NIL, pmt_from_long(1), PMT_NIL, MB_PRI_BEST +
2));
q.insert(mb_make_message(PMT_NIL, pmt_from_long(2), PMT_NIL, MB_PRI_BEST +
2));
- CPPUNIT_ASSERT_EQUAL(0L, pmt_to_long(q.get_highest_pri_msg()->data()));
- CPPUNIT_ASSERT_EQUAL(1L, pmt_to_long(q.get_highest_pri_msg()->data()));
- CPPUNIT_ASSERT_EQUAL(2L, pmt_to_long(q.get_highest_pri_msg()->data()));
+ CPPUNIT_ASSERT_EQUAL(0L,
pmt_to_long(q.get_highest_pri_msg_nowait()->data()));
+ CPPUNIT_ASSERT_EQUAL(1L,
pmt_to_long(q.get_highest_pri_msg_nowait()->data()));
+ CPPUNIT_ASSERT_EQUAL(2L,
pmt_to_long(q.get_highest_pri_msg_nowait()->data()));
- CPPUNIT_ASSERT(q.get_highest_pri_msg() == 0);
+ CPPUNIT_ASSERT(q.get_highest_pri_msg_nowait() == 0);
// insert messages of different priorities in pseudo-random order
@@ -361,19 +357,19 @@
q.insert(mb_make_message(PMT_NIL, PMT_NIL, PMT_NIL, MB_PRI_BEST + 1));
// confirm that they come out in order
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 0, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 0, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 1, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 1, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 2, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 2, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 3, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 3, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 4, q.get_highest_pri_msg()->priority());
- CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 4, q.get_highest_pri_msg()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 0,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 0,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 1,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 1,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 2,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 2,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 3,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 3,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 4,
q.get_highest_pri_msg_nowait()->priority());
+ CPPUNIT_ASSERT_EQUAL(MB_PRI_BEST + 4,
q.get_highest_pri_msg_nowait()->priority());
// check final state
- CPPUNIT_ASSERT(q.get_highest_pri_msg() == 0);
+ CPPUNIT_ASSERT(q.get_highest_pri_msg_nowait() == 0);
}
////////////////////////////////////////////////////////////////
@@ -397,10 +393,10 @@
pmt_t cs = pmt_intern("cs");
- mb_message_sptr msg = mb->impl()->msgq().get_highest_pri_msg();
+ mb_message_sptr msg = mb->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(pmt_eq(cs, msg->port_id())); // confirm that port_id
is set
CPPUNIT_ASSERT_EQUAL(0L, pmt_to_long(msg->data())); // and that data is
correct
- CPPUNIT_ASSERT_EQUAL(1L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg()->data()));
- CPPUNIT_ASSERT_EQUAL(2L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg()->data()));
+ CPPUNIT_ASSERT_EQUAL(1L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg_nowait()->data()));
+ CPPUNIT_ASSERT_EQUAL(2L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg_nowait()->data()));
}
Modified: gnuradio/trunk/mblock/src/lib/qa_mblock_send.cc
===================================================================
--- gnuradio/trunk/mblock/src/lib/qa_mblock_send.cc 2007-03-28 17:15:26 UTC
(rev 4808)
+++ gnuradio/trunk/mblock/src/lib/qa_mblock_send.cc 2007-03-28 18:58:21 UTC
(rev 4809)
@@ -28,6 +28,7 @@
#include <cppunit/TestAssert.h>
#include <mb_mblock.h>
#include <mb_runtime.h>
+#include <mb_runtime_nop.h> // QA only
#include <mb_protocol_class.h>
#include <mb_exception.h>
#include <mb_msg_queue.h>
@@ -86,10 +87,10 @@
void
sr1::init_fsm()
{
- // std::cout << fullname() << "[sr1]: init_fsm\n";
+ // std::cout << instance_name() << "[sr1]: init_fsm\n";
// send two messages to each port
- pmt_t our_name = pmt_intern(fullname());
+ pmt_t our_name = pmt_intern(instance_name());
d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(0)));
d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(1)));
@@ -127,10 +128,10 @@
void
sr0::init_fsm()
{
- // std::cout << fullname() << "[sr0]: init_fsm\n";
+ // std::cout << instance_name() << "[sr0]: init_fsm\n";
// send two messages to p0
- pmt_t our_name = pmt_intern(fullname());
+ pmt_t our_name = pmt_intern(instance_name());
d_p0->send(s_control, pmt_list3(our_name, s_p0, pmt_from_long(0)));
d_p0->send(s_control, pmt_list3(our_name, s_p0, pmt_from_long(1)));
}
@@ -149,21 +150,21 @@
mb_message_sptr msg;
- mb_runtime_sptr rt = mb_make_runtime();
+ mb_runtime_sptr rt = mb_make_runtime_nop();
mb_mblock_sptr mb0 = mb_mblock_sptr(new sr0());
rt->run(mb0);
// Reach into the guts and see if the messages ended up where they should
have
// mb0 should have received two messages sent from mb1 via its p1
- msg = mb0->impl()->msgq().get_highest_pri_msg();
+ msg = mb0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p0, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p1,
pmt_from_long(0)),
msg->data()));
- msg = mb0->impl()->msgq().get_highest_pri_msg();
+ msg = mb0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p0, msg->port_id());
@@ -176,28 +177,28 @@
mb_mblock_sptr mb1 = mb0->impl()->component("mb1");
- msg = mb1->impl()->msgq().get_highest_pri_msg();
+ msg = mb1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p1, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top"), s_p0,
pmt_from_long(0)),
msg->data()));
- msg = mb1->impl()->msgq().get_highest_pri_msg();
+ msg = mb1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p1, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top"), s_p0,
pmt_from_long(1)),
msg->data()));
- msg = mb1->impl()->msgq().get_highest_pri_msg();
+ msg = mb1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb2"), s_p2,
pmt_from_long(0)),
msg->data()));
- msg = mb1->impl()->msgq().get_highest_pri_msg();
+ msg = mb1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
@@ -210,14 +211,14 @@
mb_mblock_sptr mb2 = mb0->impl()->component("mb2");
- msg = mb2->impl()->msgq().get_highest_pri_msg();
+ msg = mb2->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p2,
pmt_from_long(0)),
msg->data()));
- msg = mb2->impl()->msgq().get_highest_pri_msg();
+ msg = mb2->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
@@ -253,10 +254,10 @@
void
rr2::init_fsm()
{
- // std::cout << fullname() << "[rr2]: init_fsm\n";
+ // std::cout << instance_name() << "[rr2]: init_fsm\n";
// send two messages via p1
- pmt_t our_name = pmt_intern(fullname());
+ pmt_t our_name = pmt_intern(instance_name());
d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(0)));
d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(1)));
}
@@ -321,7 +322,7 @@
{
mb_message_sptr msg;
- mb_runtime_sptr rt = mb_make_runtime();
+ mb_runtime_sptr rt = mb_make_runtime_nop();
mb_mblock_sptr top = mb_mblock_sptr(new rr0_a());
rt->run(top);
@@ -335,14 +336,14 @@
// c0c0 should have received
// two message from c1 via its p2
- msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ msg = c0c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
//std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1"), s_p1,
pmt_from_long(0)),
msg->data()));
- msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ msg = c0c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
//std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
@@ -352,14 +353,14 @@
// c1 should have received
// two message from c0c0 via its p2
- msg = c1->impl()->msgq().get_highest_pri_msg();
+ msg = c1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
//std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(0)),
msg->data()));
- msg = c1->impl()->msgq().get_highest_pri_msg();
+ msg = c1->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
//std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
@@ -402,7 +403,7 @@
{
mb_message_sptr msg;
- mb_runtime_sptr rt = mb_make_runtime();
+ mb_runtime_sptr rt = mb_make_runtime_nop();
mb_mblock_sptr top = mb_mblock_sptr(new rr0_b());
rt->run(top);
@@ -417,14 +418,14 @@
// c0c0 should have received
// two message from c1c0 via its p2
- msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ msg = c0c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1/c0"), s_p1,
pmt_from_long(0)),
msg->data()));
- msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ msg = c0c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
@@ -434,14 +435,14 @@
// c1c0 should have received
// two message from c0c0 via its p2
- msg = c1c0->impl()->msgq().get_highest_pri_msg();
+ msg = c1c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(0)),
msg->data()));
- msg = c1c0->impl()->msgq().get_highest_pri_msg();
+ msg = c1c0->impl()->msgq().get_highest_pri_msg_nowait();
CPPUNIT_ASSERT(msg);
// std::cerr << msg->data() << std::endl;
CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4809 - in gnuradio/trunk: . mblock/src/lib,
eb <=