[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4497 - in gnuradio/branches/developers/jcorgan/sfg/gn
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r4497 - in gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src: lib/runtime python/gnuradio/gr |
Date: |
Sat, 17 Feb 2007 20:20:14 -0700 (MST) |
Author: jcorgan
Date: 2007-02-17 20:20:14 -0700 (Sat, 17 Feb 2007)
New Revision: 4497
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_simple_flowgraph_detail.cc
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
Log:
Work in progress.
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
2007-02-17 23:12:55 UTC (rev 4496)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
2007-02-18 03:20:14 UTC (rev 4497)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -36,6 +36,7 @@
void start() throw (std::runtime_error);
void stop() throw (std::runtime_error);
void wait() throw (std::runtime_error);
+ void restart() throw (std::runtime_error);
};
%{
@@ -72,4 +73,10 @@
r->wait();
}
+void runtime_restart_unlocked(gr_runtime_sptr r) throw (std::runtime_error)
+{
+ ensure_py_gil_state2 _lock;
+ r->restart();
+}
+
%}
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2007-02-17 23:12:55 UTC (rev 4496)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
2007-02-18 03:20:14 UTC (rev 4497)
@@ -123,7 +123,7 @@
gr_simple_flowgraph_sptr new_sfg = gr_make_simple_flowgraph();
d_top_block->d_detail->flatten(new_sfg);
new_sfg->validate();
- // new_sfg->merge_connections(d_sfg)
+ new_sfg->d_detail->merge_connections(d_sfg);
// d_sfg = new_sfg;
start_threads();
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_simple_flowgraph_detail.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_simple_flowgraph_detail.cc
2007-02-17 23:12:55 UTC (rev 4496)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_simple_flowgraph_detail.cc
2007-02-18 03:20:14 UTC (rev 4497)
@@ -32,7 +32,7 @@
#include <iostream>
#include <stdexcept>
-#define GR_SIMPLE_FLOWGRAPH_DETAIL_DEBUG 0
+#define GR_SIMPLE_FLOWGRAPH_DETAIL_DEBUG 1
gr_edge_sptr
gr_make_edge(const std::string &src_name, int src_port,
@@ -247,7 +247,6 @@
if (GR_SIMPLE_FLOWGRAPH_DETAIL_DEBUG)
std::cout << "needs " << min_ports << ", only has "
<< nports << std::endl;
-
throw std::runtime_error("insufficient ports");
}
}
@@ -563,4 +562,6 @@
void
gr_simple_flowgraph_detail::merge_connections(gr_simple_flowgraph_sptr sfg)
{
+ if (GR_SIMPLE_FLOWGRAPH_DETAIL_DEBUG)
+ std::cout << "merge_connections() hit" << std::endl;
}
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
2007-02-17 23:12:55 UTC (rev 4496)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
2007-02-18 03:20:14 UTC (rev 4497)
@@ -21,7 +21,7 @@
from gnuradio_swig_python import hier_block2_swig, gr_make_runtime, \
runtime_run_unlocked, runtime_start_unlocked, runtime_stop_unlocked, \
- runtime_wait_unlocked
+ runtime_wait_unlocked, runtime_restart_unlocked
#
# This hack forces a 'has-a' relationship to look like an 'is-a' one.
@@ -41,6 +41,10 @@
def define_component(self, name, comp):
return self._hb.define_component(name, comp.basic_block())
+# This allows the 'run_locked' methods, which are defined in gr_runtime.i,
+# to release the Python global interpreter lock before calling the actual
+# method in gr.runtime
+
class runtime(object):
def __init__(self, top_block):
if (isinstance(top_block, hier_block2)):
@@ -59,3 +63,6 @@
def wait(self):
runtime_wait_unlocked(self._r)
+
+ def restart(self):
+ runtime_restart_unlocked(self._r)
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2007-02-17 23:12:55 UTC (rev 4496)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
2007-02-18 03:20:14 UTC (rev 4497)
@@ -166,6 +166,48 @@
self.assertRaises(ValueError,
lambda: hblock.disconnect("nop1", 0, "foo", 0))
+ def test_021_run(self):
+ expected = (1.0, 2.0, 3.0, 4.0)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(0,0,0),
+ gr.io_signature(0,0,0))
+ hblock.define_component("src", gr.vector_source_f(expected, False))
+ sink1 = gr.vector_sink_f()
+ sink2 = gr.vector_sink_f()
+ hblock.define_component("sink1", sink1)
+ hblock.define_component("sink2", sink2)
+ hblock.connect("src", 0, "sink1", 0)
+ hblock.connect("src", 0, "sink2", 0)
+ runtime = gr.runtime(hblock)
+ runtime.run()
+ actual1 = sink1.data()
+ actual2 = sink2.data()
+ self.assertEquals(expected, actual1)
+ self.assertEquals(expected, actual2)
+
+ def test_022_run_and_disconnect(self):
+ expected = (1.0, 2.0, 3.0, 4.0)
+
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(0,0,0),
+ gr.io_signature(0,0,0))
+ hblock.define_component("src", gr.vector_source_f(expected, False))
+ sink1 = gr.vector_sink_f()
+ sink2 = gr.vector_sink_f()
+ hblock.define_component("sink1", sink1)
+ hblock.define_component("sink2", sink2)
+ hblock.connect("src", 0, "sink1", 0)
+ hblock.connect("src", 0, "sink2", 0)
+ runtime = gr.runtime(hblock)
+ runtime.start()
+ hblock.disconnect("src", 0, "sink2", 0)
+ runtime.restart()
+ runtime.wait()
+ actual1 = sink1.data()
+ actual2 = sink2.data()
+ self.assertEquals(expected, actual1)
+ self.assertEquals((), actual2)
+
if __name__ == "__main__":
gr_unittest.main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4497 - in gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src: lib/runtime python/gnuradio/gr,
jcorgan <=