diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-06-21 15:35:30 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-06-21 15:35:30 -0400 |
commit | 5653dcfb4f3a836523921e014d2aa50014514e58 (patch) | |
tree | bdbe789c59548acf491fe49e490ac188e8aa4276 /gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc | |
parent | ad1d52fd9911114ad8c9748e808b55de4e16232b (diff) |
runtime: fixed checks on vmcircbuf file and mutex locking for creation and usage of vmcrcbuf classes.
Diffstat (limited to 'gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc')
-rw-r--r-- | gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc index ffe2a3d2c..7a02fe2de 100644 --- a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc @@ -51,6 +51,7 @@ namespace gr { fprintf(stderr, "gr::vmcircbuf_mmap_tmpfile: mmap or mkstemp is not available\n"); throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); #else + gr::thread::scoped_lock guard(s_vm_mutex); if(size <= 0 || (size % gr::pagesize ()) != 0) { fprintf(stderr, "gr::vmcircbuf_mmap_tmpfile: invalid size = %d\n", size); @@ -155,6 +156,8 @@ namespace gr { vmcircbuf_mmap_tmpfile::~vmcircbuf_mmap_tmpfile() { #if defined(HAVE_MMAP) + gr::thread::scoped_lock guard(s_vm_mutex); + if(munmap(d_base, 2 * d_size) == -1) { perror("gr::vmcircbuf_mmap_tmpfile: munmap(2)"); } |