1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-07 07:50:32 +00:00

Fix exit with enter+q when Acquisition_XX.blocking=false

This commit is contained in:
Carles Fernandez 2020-11-12 15:24:15 +01:00
parent d1b23ae3fd
commit ad5690c52f
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 13 additions and 2 deletions

View File

@ -75,6 +75,7 @@ target_link_libraries(acquisition_gr_blocks
Armadillo::armadillo Armadillo::armadillo
Gnuradio::runtime Gnuradio::runtime
Gnuradio::fft Gnuradio::fft
Threads::Threads
Volk::volk Volk::volk
Volkgnsssdr::volkgnsssdr Volkgnsssdr::volkgnsssdr
PRIVATE PRIVATE

View File

@ -930,6 +930,11 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
* 6. Declare positive or negative acquisition using a message port * 6. Declare positive or negative acquisition using a message port
*/ */
gr::thread::scoped_lock lk(d_setlock); gr::thread::scoped_lock lk(d_setlock);
if (!d_active and d_worker_active and !d_acq_parameters.blocking)
{
pthread_cancel(d_id_worker);
return 0;
}
if (!d_active or d_worker_active) if (!d_active or d_worker_active)
{ {
if (!d_acq_parameters.blocking_on_standby) if (!d_acq_parameters.blocking_on_standby)
@ -1016,7 +1021,9 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
} }
else else
{ {
gr::thread::thread d_worker(&pcps_acquisition::acquisition_core, this, d_sample_counter); d_worker = std::thread([&] { pcps_acquisition::acquisition_core(d_sample_counter); });
d_id_worker = d_worker.native_handle();
d_worker.detach();
d_worker_active = true; d_worker_active = true;
} }
consume_each(0); consume_each(0);

View File

@ -59,10 +59,11 @@
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <pthread.h>
#include <queue> #include <queue>
#include <string> #include <string>
#include <thread>
#include <utility> #include <utility>
#if HAS_STD_SPAN #if HAS_STD_SPAN
#include <span> #include <span>
namespace own = std; namespace own = std;
@ -259,6 +260,8 @@ private:
arma::fmat d_narrow_grid; arma::fmat d_narrow_grid;
std::string d_dump_filename; std::string d_dump_filename;
std::thread d_worker;
pthread_t d_id_worker;
int64_t d_dump_number; int64_t d_dump_number;
uint64_t d_sample_counter; uint64_t d_sample_counter;