Fix for threads not terminating

This commit is contained in:
Ryzerth 2021-04-21 17:23:09 +02:00
parent a0316e57c5
commit 4849d9cf09

View File

@ -70,6 +70,11 @@ namespace dsp {
Reshaper(stream<T>* in, int keep, int skip) { init(in, keep, skip); } Reshaper(stream<T>* in, int keep, int skip) { init(in, keep, skip); }
// NOTE: For some reason, the base class destrcutor doesn't get called.... this is a temporary fix I guess
~Reshaper() {
generic_block<Reshaper<T>>::stop();
}
void init(stream<T>* in, int keep, int skip) { void init(stream<T>* in, int keep, int skip) {
_in = in; _in = in;
_keep = keep; _keep = keep;
@ -114,7 +119,7 @@ namespace dsp {
stream<T> out; stream<T> out;
private: private:
void doStart() { void doStart() override {
workThread = std::thread(&Reshaper<T>::loop, this); workThread = std::thread(&Reshaper<T>::loop, this);
bufferWorkerThread = std::thread(&Reshaper<T>::bufferWorker, this); bufferWorkerThread = std::thread(&Reshaper<T>::bufferWorker, this);
} }
@ -123,7 +128,7 @@ namespace dsp {
while (run() >= 0); while (run() >= 0);
} }
void doStop() { void doStop() override {
_in->stopReader(); _in->stopReader();
ringBuf.stopReader(); ringBuf.stopReader();
out.stopWriter(); out.stopWriter();