Ensure clean exit of NR UE
- Shutdown DL/UL actors - Join the main/stat UE threads
This commit is contained in:
+2
-4
@@ -1162,13 +1162,11 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf
|
||||
}
|
||||
|
||||
void init_NR_UE_threads(PHY_VARS_NR_UE *UE) {
|
||||
pthread_t thread;
|
||||
char thread_name[16];
|
||||
sprintf(thread_name, "UEthread_%d", UE->Mod_id);
|
||||
threadCreate(&thread, UE_thread, (void *)UE, thread_name, -1, OAI_PRIORITY_RT_MAX);
|
||||
threadCreate(&UE->main_thread, UE_thread, (void *)UE, thread_name, -1, OAI_PRIORITY_RT_MAX);
|
||||
if (!IS_SOFTMODEM_NOSTATS) {
|
||||
pthread_t stat_pthread;
|
||||
sprintf(thread_name, "L1_UE_stats_%d", UE->Mod_id);
|
||||
threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, thread_name, -1, OAI_PRIORITY_RT_LOW);
|
||||
threadCreate(&UE->stat_thread, nrL1_UE_stats_thread, UE, thread_name, -1, OAI_PRIORITY_RT_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sched.h>
|
||||
#include <stdbool.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "T.h"
|
||||
#include "common/oai_version.h"
|
||||
@@ -572,8 +573,20 @@ int main(int argc, char **argv)
|
||||
if (PHY_vars_UE_g && PHY_vars_UE_g[0]) {
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
PHY_VARS_NR_UE *phy_vars = PHY_vars_UE_g[0][CC_id];
|
||||
if (phy_vars && phy_vars->rfdevice.trx_end_func)
|
||||
phy_vars->rfdevice.trx_end_func(&phy_vars->rfdevice);
|
||||
if (phy_vars) {
|
||||
shutdown_actor(&phy_vars->ul_actor);
|
||||
for (int i = 0; i < NUM_DL_ACTORS; i++) {
|
||||
shutdown_actor(&phy_vars->dl_actors[i]);
|
||||
}
|
||||
int ret = pthread_join(phy_vars->main_thread, NULL);
|
||||
AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno));
|
||||
if (!IS_SOFTMODEM_NOSTATS) {
|
||||
ret = pthread_join(phy_vars->stat_thread, NULL);
|
||||
AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno));
|
||||
}
|
||||
if (phy_vars->rfdevice.trx_end_func)
|
||||
phy_vars->rfdevice.trx_end_func(&phy_vars->rfdevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -549,6 +549,8 @@ typedef struct PHY_VARS_NR_UE_s {
|
||||
Actor_t dl_actors[NUM_DL_ACTORS];
|
||||
Actor_t ul_actor;
|
||||
ntn_config_message_t* ntn_config_message;
|
||||
pthread_t main_thread;
|
||||
pthread_t stat_thread;
|
||||
} PHY_VARS_NR_UE;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user