From 1409e3bcb4e997ec54360c05146f53fe93a9ee32 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Tue, 8 Feb 2022 12:47:22 +0100
Subject: [PATCH] nr-ue: fix T tracer

T tracer was not functional anymore. because init_tpools() was called
before T_Config_Init().

The problem was that init_tpools() creates some threads and T_Config_Init()
does call fork() and the child process (which is the one running the
softmodem, the parent process is used to monitor it, this is the design
of the T tracer, maybe to change at some point, it's too complicated) has
no thread after the fork(). The threads created by init_tpools() are gone.
Game over.

In conclusion: T_Config_Init() has to be called very early in the life of
the softmodem, at least before init_tpools().
---
 executables/nr-uesoftmodem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index ddbbbdf52c1..7663e9ebd8d 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -422,11 +422,11 @@ int main( int argc, char **argv ) {
   get_options (); //Command-line options specific for NRUE
 
   get_common_options(SOFTMODEM_5GUE_BIT);
-  init_tpools(nrUE_params.nr_dlsch_parallel);
   CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
 #if T_TRACER
   T_Config_Init();
 #endif
+  init_tpools(nrUE_params.nr_dlsch_parallel);
   //randominit (0);
   set_taus_seed (0);
 
-- 
GitLab