diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-06-14 18:15:50 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-06-14 18:15:50 -0400 |
commit | 234b0f02a954928c54485c38ef37126ba5197597 (patch) | |
tree | f5e8050e9463d80e81e48addb9da873a3c3a20dd /gnuradio-runtime/lib/flat_flowgraph.cc | |
parent | 2fb6d0a21a133207e9b93545c4fe3754d22cdfc7 (diff) |
runtime: 2 threading issues with the shared memory system.
1. Making a global mutex for the VM circular buffers to use and lock for multiple top_blocks to handle accessing the memory.
2. Catch the bad_alloc exception once and retry. After 1., this rarely happens unless the thread count gets large (> 20 as an estimate).
Diffstat (limited to 'gnuradio-runtime/lib/flat_flowgraph.cc')
-rw-r--r-- | gnuradio-runtime/lib/flat_flowgraph.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/flat_flowgraph.cc b/gnuradio-runtime/lib/flat_flowgraph.cc index b8a1a67bc7..ae79288334 100644 --- a/gnuradio-runtime/lib/flat_flowgraph.cc +++ b/gnuradio-runtime/lib/flat_flowgraph.cc @@ -161,7 +161,16 @@ namespace gr { } // std::cout << "make_buffer(" << nitems << ", " << item_size << ", " << grblock << "\n"; - return make_buffer(nitems, item_size, grblock); + // We're going to let this fail once and retry. If that fails, + // throw and exit. + buffer_sptr b; + try { + b = make_buffer(nitems, item_size, grblock); + } + catch(std::bad_alloc&) { + b = make_buffer(nitems, item_size, grblock); + } + return b; } void |