Rewrite kill_NR_RU_proc() and reuse functions

This commit is contained in:
Robert Schmidt
2022-08-16 14:41:02 +02:00
parent 9ec3deb5bd
commit 1512e39e4e
3 changed files with 47 additions and 28 deletions
+14 -28
View File
@@ -1331,40 +1331,26 @@ void init_RU_proc(RU_t *ru) {
}
void kill_NR_RU_proc(int inst) {
RU_t *ru = RC.ru[inst];
RU_proc_t *proc = &ru->proc;
LOG_D(PHY, "Joining pthread_FH\n");
/* Note: it seems pthread_FH and and FEP thread below both use
* mutex_fep/cond_fep. Thus, we unlocked above for pthread_FH above and do
* the same for FEP thread below again (using broadcast() to ensure both
* threads get the signal). This one will also destroy the mutex and cond. */
pthread_mutex_lock(&proc->mutex_fep);
proc->instance_cnt_fep = 0;
pthread_cond_broadcast(&proc->cond_fep);
pthread_mutex_unlock( &proc->mutex_fep );
pthread_join(proc->pthread_FH, NULL);
if (get_nprocs() >= 2) {
if (ru->feprx) {
pthread_mutex_lock(&proc->mutex_fep);
proc->instance_cnt_fep = 0;
pthread_mutex_unlock(&proc->mutex_fep);
pthread_cond_signal(&proc->cond_fep);
LOG_D(PHY, "Joining pthread_fep\n");
pthread_join(proc->pthread_fep, NULL);
pthread_mutex_destroy(&proc->mutex_fep);
pthread_cond_destroy(&proc->cond_fep);
}
if (ru->feprx)
nr_kill_feprx_thread(ru);
if (ru->feptx_ofdm) {
pthread_mutex_lock(&proc->mutex_feptx);
proc->instance_cnt_feptx = 0;
pthread_mutex_unlock(&proc->mutex_feptx);
pthread_cond_signal(&proc->cond_feptx);
LOG_D(PHY, "Joining pthread_feptx\n");
pthread_join(proc->pthread_feptx, NULL);
pthread_mutex_destroy(&proc->mutex_feptx);
pthread_cond_destroy(&proc->cond_feptx);
}
}
if (opp_enabled) {
LOG_D(PHY, "Joining ru_stats_thread\n");
pthread_join(ru->ru_stats_thread, NULL);
}
if (ru->feptx_ofdm)
nr_kill_feptx_thread(ru);
}
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {