aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-17 10:57:09 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-17 10:57:09 +0200
commit7d08079131f01b9e0cddc81c0e42e18ec8fa63f8 (patch)
treea9362c6ae0cb6cc5bd00cb0cecbaf9b0e722524f /src/OutputUHD.h
parent45c2d54e57bd26ef91d1dd1f011a17f20623443a (diff)
downloaddabmod-7d08079131f01b9e0cddc81c0e42e18ec8fa63f8.tar.gz
dabmod-7d08079131f01b9e0cddc81c0e42e18ec8fa63f8.tar.bz2
dabmod-7d08079131f01b9e0cddc81c0e42e18ec8fa63f8.zip
fix segfault on SIGINT before UHD init completes
Diffstat (limited to 'src/OutputUHD.h')
-rw-r--r--src/OutputUHD.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index 6de945e..a74f627 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -126,9 +126,11 @@ struct UHDWorkerData {
class UHDWorker {
public:
- void start(struct UHDWorkerData *uhdworkerdata) {
+ UHDWorker(struct UHDWorkerData *uhdworkerdata) {
uwd = uhdworkerdata;
+ }
+ void start(struct UHDWorkerData *uhdworkerdata) {
uwd->running = true;
uhd_thread = boost::thread(&UHDWorker::process_errhandler, this);
}
@@ -141,6 +143,13 @@ class UHDWorker {
uhd_thread.join();
}
+ ~UHDWorker() {
+ stop();
+ }
+
+ UHDWorker(const UHDWorker& other) = delete;
+ UHDWorker& operator=(const UHDWorker& other) = delete;
+
private:
// Asynchronous message statistics
int num_underflows;
@@ -234,17 +243,17 @@ class OutputUHD: public ModOutput, public RemoteControllable {
protected:
- OutputUHD(const OutputUHD& other);
- OutputUHD& operator=(const OutputUHD& other);
+ OutputUHD(const OutputUHD& other) = delete;
+ OutputUHD& operator=(const OutputUHD& other) = delete;
EtiReader *myEtiReader;
OutputUHDConfig& myConf;
uhd::usrp::multi_usrp::sptr myUsrp;
std::shared_ptr<boost::barrier> mySyncBarrier;
- UHDWorker worker;
bool first_run;
bool gps_fix_verified;
struct UHDWorkerData uwd;
+ UHDWorker worker;
private:
// Resize the internal delay buffer according to the dabMode and