From 70b461100179ef14396cdcb2ae8f84ed0037b9c4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 28 Nov 2024 14:42:00 +0100 Subject: [PATCH] Stop L1_rx_thread/L1_tx_thread first These are the "main" worker threads (apart the ru_thread). If the thread-pool stops, they might get stuck. E.g., in PUSCH channel estimation, it uses a local response queue, and if the thread pool is terminated, it seems that the L1_rx_thread can get stuck in there. To limit these problems, attempt to stop these threads first; stop the queue from which they read and make them terminate; then, stop the thread pool. Also, fix the termination of respPuschSymb queue. --- executables/nr-gnb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 4206cfd585..48c5aca630 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -383,12 +383,16 @@ void init_gNB_Tpool(int inst) { void term_gNB_Tpool(int inst) { PHY_VARS_gNB *gNB = RC.gNB[inst]; - abortTpool(&gNB->threadPool); - abortNotifiedFIFO(&gNB->respDecode); abortNotifiedFIFO(&gNB->resp_L1); + pthread_join(gNB->L1_rx_thread, NULL); + abortNotifiedFIFO(&gNB->L1_tx_out); + pthread_join(gNB->L1_tx_thread, NULL); + + abortTpool(&gNB->threadPool); + abortNotifiedFIFO(&gNB->respPuschSymb); + abortNotifiedFIFO(&gNB->respDecode); abortNotifiedFIFO(&gNB->L1_tx_free); abortNotifiedFIFO(&gNB->L1_tx_filled); - abortNotifiedFIFO(&gNB->L1_tx_out); abortNotifiedFIFO(&gNB->L1_rx_out); gNB_L1_proc_t *proc = &gNB->proc;