1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +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
Gnuradio::runtime
Gnuradio::fft
Threads::Threads
Volk::volk
Volkgnsssdr::volkgnsssdr
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
*/
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_acq_parameters.blocking_on_standby)
@ -1016,7 +1021,9 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
}
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;
}
consume_each(0);

View File

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