[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4089 - in gnuradio/branches/developers/jcorgan/sfg/gn
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r4089 - in gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src: lib/runtime python/gnuradio/gr |
Date: |
Thu, 14 Dec 2006 16:35:03 -0700 (MST) |
Author: jcorgan
Date: 2006-12-14 16:35:03 -0700 (Thu, 14 Dec 2006)
New Revision: 4089
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
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_runtime.py
Log:
Initial fix for GIL lock issue.
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
2006-12-14 23:11:11 UTC (rev 4088)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/lib/runtime/gr_runtime.i
2006-12-14 23:35:03 UTC (rev 4089)
@@ -37,3 +37,39 @@
void stop() throw (std::runtime_error);
void wait() throw (std::runtime_error);
};
+
+%{
+class ensure_py_gil_state2 {
+ PyGILState_STATE d_gstate;
+public:
+ ensure_py_gil_state2() { d_gstate = PyGILState_Ensure(); }
+ ~ensure_py_gil_state2() { PyGILState_Release(d_gstate); }
+};
+%}
+
+%inline %{
+void runtime_run_unlocked(gr_runtime_sptr r) throw (std::runtime_error)
+{
+ ensure_py_gil_state2 _lock;
+ r->run();
+}
+
+void runtime_start_unlocked(gr_runtime_sptr r) throw (std::runtime_error)
+{
+ ensure_py_gil_state2 _lock;
+ r->start();
+}
+
+void runtime_stop_unlocked(gr_runtime_sptr r) throw (std::runtime_error)
+{
+ ensure_py_gil_state2 _lock;
+ r->stop();
+}
+
+void runtime_wait_unlocked(gr_runtime_sptr r) throw (std::runtime_error)
+{
+ ensure_py_gil_state2 _lock;
+ r->wait();
+}
+
+%}
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
2006-12-14 23:11:11 UTC (rev 4088)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
2006-12-14 23:35:03 UTC (rev 4089)
@@ -19,7 +19,9 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio_swig_python import hier_block2_swig, gr_make_runtime
+from gnuradio_swig_python import hier_block2_swig, gr_make_runtime, \
+ runtime_run_unlocked, runtime_start_unlocked, runtime_stop_unlocked, \
+ runtime_wait_unlocked
#
# This hack forces a 'has-a' relationship to look like an 'is-a' one.
@@ -47,4 +49,13 @@
self._r = gr_make_runtime(top_block)
def run(self):
- self._r.run()
+ runtime_run_unlocked(self._r)
+
+ def start(self):
+ runtime_start_unlocked(self._r)
+
+ def stop(self):
+ runtime_stop_unlocked(self._r)
+
+ def wait(self):
+ runtime_wait_unlocked(self._r)
Modified:
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py
2006-12-14 23:11:11 UTC (rev 4088)
+++
gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src/python/gnuradio/gr/qa_runtime.py
2006-12-14 23:35:03 UTC (rev 4089)
@@ -11,19 +11,19 @@
pass
def test_001_run(self):
- hblock = gr.hier_block2("test_block",
+ hblock = gr.hier_block2("test_block",
gr.io_signature(0,0,0),
gr.io_signature(0,0,0))
- runtime = gr.runtime(hblock)
- runtime.run()
+ runtime = gr.runtime(hblock)
+ runtime.run()
def test_002_run_twice(self):
- hblock = gr.hier_block2("test_block",
+ hblock = gr.hier_block2("test_block",
gr.io_signature(0,0,0),
gr.io_signature(0,0,0))
- runtime = gr.runtime(hblock)
- runtime.run()
- self.assertRaises(RuntimeError, lambda: runtime.run())
+ runtime = gr.runtime(hblock)
+ runtime.run()
+ self.assertRaises(RuntimeError, lambda: runtime.run())
if __name__ == "__main__":
gr_unittest.main()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4089 - in gnuradio/branches/developers/jcorgan/sfg/gnuradio-core/src: lib/runtime python/gnuradio/gr,
jcorgan <=