summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/flat_flowgraph.cc
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-06-14 18:15:50 -0400
committerTom Rondeau <trondeau@vt.edu>2013-06-14 18:15:50 -0400
commit234b0f02a954928c54485c38ef37126ba5197597 (patch)
treef5e8050e9463d80e81e48addb9da873a3c3a20dd /gnuradio-runtime/lib/flat_flowgraph.cc
parent2fb6d0a21a133207e9b93545c4fe3754d22cdfc7 (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.cc11
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