From ea49a8813b7a7650f6b883c12c5a0f1c70dacd2d Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 11 Jan 2023 15:08:58 +0100 Subject: [PATCH] FT8 denod: removed thread dependency in FT8 class --- ft8/ft8.cpp | 14 ++++++++------ ft8/ft8.h | 3 --- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ft8/ft8.cpp b/ft8/ft8.cpp index 1360981fa..398460924 100644 --- a/ft8/ft8.cpp +++ b/ft8/ft8.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include // #include #include "util.h" @@ -3493,7 +3495,7 @@ void FT8Decoder::entry( } float per = (max_hz - min_hz) / params.nthreads; - std::vector thv; + std::vector> thv; for (int i = 0; i < params.nthreads; i++) { @@ -3529,15 +3531,15 @@ void FT8Decoder::entry( ft8->getParams() = getParams(); // transfer parameters int npasses = nprevdecs > 0 ? params.npasses_two : params.npasses_one; - ft8->th_ = new std::thread([ft8, npasses] () { ft8->go(npasses); }); - thv.push_back(ft8); + std::thread *th = new std::thread([ft8, npasses] () { ft8->go(npasses); }); + thv.push_back(std::pair(ft8, th)); } for (int i = 0; i < (int)thv.size(); i++) { - thv[i]->th_->join(); - delete thv[i]->th_; - delete thv[i]; + thv[i].second->join(); + delete thv[i].second; + delete thv[i].first; } } diff --git a/ft8/ft8.h b/ft8/ft8.h index 4fa813117..851b52999 100644 --- a/ft8/ft8.h +++ b/ft8/ft8.h @@ -21,7 +21,6 @@ #ifndef ft8_h #define ft8_h -#include #include #include "fft.h" @@ -265,8 +264,6 @@ struct FT8_API FT8Params class FT8_API FT8 { public: - std::thread *th_; - float min_hz_; float max_hz_; std::vector samples_; // input to each pass