diff options
author | Thomas Habets <thomas@habets.se> | 2020-04-10 17:40:11 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-11 01:41:39 +0200 |
commit | b5e8a552c09a1b9a1397e731cc6f54d427df9a67 (patch) | |
tree | dc60d92c7f53d5d15cbf42d2c5a2623a557eb7ca /gnuradio-runtime/lib/logger.cc | |
parent | 616879745ce5d61e6acd54ad84d60359a739a27d (diff) |
runtime: Remove most manual memory management
The remaining ones:
* `pmt_pool.cc`, which is a memory allocator so that makes sense
* the tricky and aptly named `sptr_magic.cc`.
Diffstat (limited to 'gnuradio-runtime/lib/logger.cc')
-rw-r--r-- | gnuradio-runtime/lib/logger.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gnuradio-runtime/lib/logger.cc b/gnuradio-runtime/lib/logger.cc index f281f82e69..f282ca9276 100644 --- a/gnuradio-runtime/lib/logger.cc +++ b/gnuradio-runtime/lib/logger.cc @@ -20,6 +20,7 @@ #include <gnuradio/logger.h> #include <gnuradio/prefs.h> +#include <boost/make_unique.hpp> #include <algorithm> #include <stdexcept> @@ -87,7 +88,7 @@ void logger_config::load_config(std::string filename, unsigned int watch_period) instance.filename = filename; instance.watch_period = watch_period; // Stop any file watching thread - if (instance.watch_thread != NULL) + if (instance.watch_thread) stop_watch(); // Load configuration // std::cout<<"GNURadio Loading logger @@ -95,8 +96,8 @@ void logger_config::load_config(std::string filename, unsigned int watch_period) logger_configured = logger_load_config(instance.filename); // Start watch if required if (instance.watch_period > 0) { - instance.watch_thread = - new boost::thread(watch_file, instance.filename, instance.watch_period); + instance.watch_thread = boost::make_unique<boost::thread>( + watch_file, instance.filename, instance.watch_period); } } } @@ -108,8 +109,7 @@ void logger_config::stop_watch() if (instance.watch_thread) { instance.watch_thread->interrupt(); instance.watch_thread->join(); - delete (instance.watch_thread); - instance.watch_thread = NULL; + instance.watch_thread.reset(); } } |