Changeset 6782
- Timestamp:
- 11/01/07 21:02:56
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/trunk/gnuradio-core/src/lib/runtime/gr_top_block.i
r6466 r6782 50 50 }; 51 51 52 %{53 class ensure_py_gil_state2 {54 PyGILState_STATE d_gstate;55 public:56 ensure_py_gil_state2() { d_gstate = PyGILState_Ensure(); }57 ~ensure_py_gil_state2() { PyGILState_Release(d_gstate); }58 };59 %}60 61 52 %inline %{ 62 53 void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error) 63 54 { 64 ensure_py_gil_state2 _lock;55 Py_BEGIN_ALLOW_THREADS; // release global interpreter lock 65 56 r->run(); 57 Py_END_ALLOW_THREADS; // acquire global interpreter lock 66 58 } 67 59 68 60 void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error) 69 61 { 70 ensure_py_gil_state2 _lock;62 Py_BEGIN_ALLOW_THREADS; // release global interpreter lock 71 63 r->wait(); 64 Py_END_ALLOW_THREADS; // acquire global interpreter lock 72 65 } 73 66 %}
