1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-09 12:16:46 +00:00

Fix data race condition

This commit is contained in:
Carles Fernandez 2023-11-28 12:01:16 +01:00
parent 3c24b564c9
commit 73100a7b64
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 36 additions and 21 deletions

View File

@ -853,6 +853,22 @@ void galileo_telemetry_decoder_gs::set_channel(int32_t channel)
}
void galileo_telemetry_decoder_gs::check_tlm_separation()
{
gr::thread::scoped_lock lock(d_setlock);
if (d_sent_tlm_failed_msg == false)
{
if ((d_symbol_counter - d_last_valid_preamble) > d_max_symbols_without_valid_frame)
{
const int message = 1; // bad telemetry
DLOG(INFO) << "Wrong tlm sync in sat " << this->d_satellite;
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(message));
d_sent_tlm_failed_msg = true;
}
}
}
int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -916,17 +932,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
d_flag_preamble = false;
// check if there is a problem with the telemetry of the current satellite
if (d_sent_tlm_failed_msg == false)
{
gr::thread::scoped_lock lock(d_setlock);
if ((d_symbol_counter - d_last_valid_preamble) > d_max_symbols_without_valid_frame)
{
const int message = 1; // bad telemetry
DLOG(INFO) << "sent msg sat " << this->d_satellite;
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(message));
d_sent_tlm_failed_msg = true;
}
}
check_tlm_separation();
// ******* frame sync ******************
int32_t corr_value = 0;

View File

@ -80,6 +80,7 @@ private:
galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, int frame_type);
void check_tlm_separation();
void msg_handler_read_galileo_tow_map(const pmt::pmt_t &msg);
void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
void decode_INAV_word(float *page_part_symbols, int32_t frame_length, double cn0);

View File

@ -428,6 +428,21 @@ void gps_l1_ca_telemetry_decoder_gs::reset()
}
void gps_l1_ca_telemetry_decoder_gs::check_tlm_separation()
{
gr::thread::scoped_lock lock(d_setlock);
if (d_stat < 2 && d_sent_tlm_failed_msg == false)
{
if ((d_sample_counter - d_last_valid_preamble) > d_max_symbols_without_valid_frame)
{
const int message = 1; // bad telemetry
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(message));
d_sent_tlm_failed_msg = true;
}
}
}
int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -461,17 +476,9 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
d_sample_counter++; // count for the processed symbols
consume_each(1);
d_flag_preamble = false;
// check if there is a problem with the telemetry of the current satellite
if (d_stat < 2 && d_sent_tlm_failed_msg == false)
{
gr::thread::scoped_lock lock(d_setlock);
if ((d_sample_counter - d_last_valid_preamble) > d_max_symbols_without_valid_frame)
{
const int message = 1; // bad telemetry
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(message));
d_sent_tlm_failed_msg = true;
}
}
check_tlm_separation();
// ******* frame sync ******************
switch (d_stat)

View File

@ -73,6 +73,7 @@ private:
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
void check_tlm_separation();
bool gps_word_parityCheck(uint32_t gpsword);
bool decode_subframe(double cn0, bool flag_invert);