mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04:00
FT8 denod: removed thread dependency in FT8 class
This commit is contained in:
parent
508da7da9c
commit
ea49a8813b
14
ft8/ft8.cpp
14
ft8/ft8.cpp
@ -40,6 +40,8 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
#include <thread>
|
||||||
// #include <QDebug>
|
// #include <QDebug>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -3493,7 +3495,7 @@ void FT8Decoder::entry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
float per = (max_hz - min_hz) / params.nthreads;
|
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++)
|
for (int i = 0; i < params.nthreads; i++)
|
||||||
{
|
{
|
||||||
@ -3529,15 +3531,15 @@ void FT8Decoder::entry(
|
|||||||
ft8->getParams() = getParams(); // transfer parameters
|
ft8->getParams() = getParams(); // transfer parameters
|
||||||
|
|
||||||
int npasses = nprevdecs > 0 ? params.npasses_two : params.npasses_one;
|
int npasses = nprevdecs > 0 ? params.npasses_two : params.npasses_one;
|
||||||
ft8->th_ = new std::thread([ft8, npasses] () { ft8->go(npasses); });
|
std::thread *th = new std::thread([ft8, npasses] () { ft8->go(npasses); });
|
||||||
thv.push_back(ft8);
|
thv.push_back(std::pair<FT8*, std::thread*>(ft8, th));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < (int)thv.size(); i++)
|
for (int i = 0; i < (int)thv.size(); i++)
|
||||||
{
|
{
|
||||||
thv[i]->th_->join();
|
thv[i].second->join();
|
||||||
delete thv[i]->th_;
|
delete thv[i].second;
|
||||||
delete thv[i];
|
delete thv[i].first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#ifndef ft8_h
|
#ifndef ft8_h
|
||||||
#define ft8_h
|
#define ft8_h
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
|
||||||
@ -265,8 +264,6 @@ struct FT8_API FT8Params
|
|||||||
class FT8_API FT8
|
class FT8_API FT8
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::thread *th_;
|
|
||||||
|
|
||||||
float min_hz_;
|
float min_hz_;
|
||||||
float max_hz_;
|
float max_hz_;
|
||||||
std::vector<float> samples_; // input to each pass
|
std::vector<float> samples_; // input to each pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user