FT8 denod: removed thread dependency in FT8 class

This commit is contained in:
f4exb 2023-01-11 15:08:58 +01:00
parent 508da7da9c
commit ea49a8813b
2 changed files with 8 additions and 9 deletions

View File

@ -40,6 +40,8 @@
#include <random>
#include <functional>
#include <map>
#include <utility>
#include <thread>
// #include <QDebug>
#include "util.h"
@ -3493,7 +3495,7 @@ void FT8Decoder::entry(
}
float per = (max_hz - min_hz) / params.nthreads;
std::vector<FT8 *> thv;
std::vector<std::pair<FT8*, std::thread*>> 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*, std::thread*>(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;
}
}

View File

@ -21,7 +21,6 @@
#ifndef ft8_h
#define ft8_h
#include <thread>
#include <QMutex>
#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<float> samples_; // input to each pass