mirror of https://github.com/PentHertz/srsLTE.git
benchmark_radio: don't join plot_thread if not requested
This commit is contained in:
parent
cdbe6a6e1d
commit
767d5390f9
|
@ -56,6 +56,7 @@ static pthread_t radio_thread;
|
|||
#include "srsgui/srsgui.h"
|
||||
#include <semaphore.h>
|
||||
static pthread_t plot_thread;
|
||||
static bool plot_thread_launched = false;
|
||||
static sem_t plot_sem;
|
||||
static uint32_t plot_sf_idx = 0;
|
||||
static plot_real_t fft_plot[SRSRAN_MAX_RADIOS] = {};
|
||||
|
@ -247,6 +248,7 @@ static int init_plots(uint32_t frame_size)
|
|||
perror("pthread_create");
|
||||
exit(-1);
|
||||
}
|
||||
plot_thread_launched = true;
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
@ -315,7 +317,10 @@ static void* radio_thread_run(void* arg)
|
|||
|
||||
#ifdef ENABLE_GUI
|
||||
if (fft_plot_enable) {
|
||||
init_plots(frame_size);
|
||||
if (init_plots(frame_size) != SRSRAN_SUCCESS) {
|
||||
ERROR("Error: Could not init plots");
|
||||
goto clean_exit;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
#endif /* ENABLE_GUI */
|
||||
|
@ -574,18 +579,22 @@ clean_exit:
|
|||
srsran_dft_plan_free(&idft_plan);
|
||||
|
||||
#ifdef ENABLE_GUI
|
||||
pthread_join(plot_thread, NULL);
|
||||
srsran_dft_plan_free(&dft_spectrum);
|
||||
for (uint32_t r = 0; r < nof_radios; r++) {
|
||||
for (uint32_t p = 0; p < nof_ports; p++) {
|
||||
uint32_t plot_idx = r * nof_ports + p;
|
||||
if (fft_plot_buffer[plot_idx]) {
|
||||
free(fft_plot_buffer[plot_idx]);
|
||||
if (fft_plot_enable) {
|
||||
if (plot_thread_launched == true) {
|
||||
pthread_join(plot_thread, NULL);
|
||||
}
|
||||
srsran_dft_plan_free(&dft_spectrum);
|
||||
for (uint32_t r = 0; r < nof_radios; r++) {
|
||||
for (uint32_t p = 0; p < nof_ports; p++) {
|
||||
uint32_t plot_idx = r * nof_ports + p;
|
||||
if (fft_plot_buffer[plot_idx]) {
|
||||
free(fft_plot_buffer[plot_idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fft_plot_temp) {
|
||||
free(fft_plot_temp);
|
||||
if (fft_plot_temp) {
|
||||
free(fft_plot_temp);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_GUI */
|
||||
|
||||
|
|
Loading…
Reference in New Issue